close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

2nd Add to Cart For Single Songs Not Working

Thread began 8/17/2012 10:20 am by sfranzken73972 | Last modified 8/18/2012 2:18 am by sfranzken73972 | 1665 views | 6 replies |

sfranzken73972

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

Sign in to reply to this post

Jason ByrnesWebAssist

send a copy of your page please so i can see the code.

Sign in to reply to this post

sfranzken73972

Sure and thanks

Thank you for looking into that Jason

Attached Files
music.zip
Sign in to reply to this post

Jason ByrnesWebAssist

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.

Sign in to reply to this post

sfranzken73972

Ah

What would I need to do to fix that?

Sign in to reply to this post

Jason ByrnesWebAssist

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:

php:
$query_detail2productsaudio = "SELECT * FROM productsaudio ORDER BY productname";




then at line 341, change the code that is dynamic changing the where clause:

php:
$nested_query_detail2productsaudio = str_replace("123456789", $row_master1album['id'], $query_detail2productsaudio);



to:

php:
$query_detail2productsaudio = "SELECT * FROM productsaudio WHERE aid=123456789 ORDER BY productname";

$nested_query_detail2productsaudio = str_replace("123456789", $row_master1album['id'], $query_detail2productsaudio);
Sign in to reply to this post

sfranzken73972

Wow that is great

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.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

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.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...