2nd Add to Cart For Single Songs Not Working
I have two add to cart buttons, one works one does not but I cannot tell why?
music.php
I have two add to cart buttons, one works one does not but I cannot tell why?
music.php
send a copy of your page please so i can see the code.
the problem is caused by the way you are dynamicly setting the recordset in the loop to display the albums.
at line 169 the detail2productsaudio recordset is created using this query:
$query_detail2productsaudio = "SELECT * FROM productsaudio WHERE aid=123456789 ORDER BY productname";
Further down the page in the main recrdset loop, you modify this query to show the song records for the album being displayed. at line 341, it uses this code to accomplish that:
$nested_query_detail2productsaudio = str_replace("123456789", $row_master1album['id'], $query_detail2productsaudio);
well, the problem with this, is that when the add to cart button is pressed, it passes the song iD, and uses that song id to find the coresponding record.
The recordset it uses to look for the sond id is the initial one. but because it is being filtered:
WHERE aid=123456789
the selected song is not a part of the data returned by the recordset.
The recordset that is used by the add to cart button, needs to return the record that is being added to the cart.
remove the where clause form the recordset and find another way to set the where cluas in the loop
at line 169, change the query to:
$query_detail2productsaudio = "SELECT * FROM productsaudio ORDER BY productname";
then at line 341, change the code that is dynamic changing the where clause:
$nested_query_detail2productsaudio = str_replace("123456789", $row_master1album['id'], $query_detail2productsaudio);
to:
$query_detail2productsaudio = "SELECT * FROM productsaudio WHERE aid=123456789 ORDER BY productname";
$nested_query_detail2productsaudio = str_replace("123456789", $row_master1album['id'], $query_detail2productsaudio);
Very nice! Thank you so much for doing that for me I will be sure to study the code and figure out how to do that for future projects.
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
These out-of-the-box solutions provide you proven, tested applications that can be up and running now. Build a store, a gallery, or a web-based email solution.