Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Accessing a product with attributes from shopping cart page


Atrosh

Recommended Posts

Posted

Hello everyone,

 

I have a problem regarding accessing products from my shopping cart (ie clicking on the product added to my shopping cart from the shopping cart view). The problem only applies to products WITH attributes.

 

When trying to access the product page from the shopping cart, the resulting link looks something like this MYDOMAIN/product_info.php?products_id=1161{2}1

which obviously generates an SQL error when clicking it. I guess I could try modifying shopping_cart to remove anything after the { bracket in the links, but I'm guessing that isn't the root of the problem. Everything else works as it should (ie updating the cart, removing the product from cart, going to checkout etc), it's just that you can't click the product to get to the product page from there...

 

Any suggestions?

Posted

A TEMPORARY solution was tried and tested successfully:

 

The original code for $product_name was


     $products_name = '<table border="0" cellspacing="2" cellpadding="2">' .
                      '  <tr>' .
                      '    <td class="productListing-data" align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>' .
                      '    <td class="productListing-data" valign="middle"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '"><b>' . $products[$i]['name'] . '</b></a>';

 

I tried changing the $products[$i]['id'] part to

$var = explode("{", $products[$i]['id']);

     $products_name = '<table border="0" cellspacing="2" cellpadding="2">' .
                      '  <tr>' .
                      '    <td class="productListing-data" align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $var[0]) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>' .
                      '    <td class="productListing-data" valign="middle"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $var[0]) . '"><b>' . $products[$i]['name'] . '</b></a>';

 

which essentially just strips everything after the { sign from the product_id part in the links (one for the image link, one for the text link). This is a temporary solution but I'm hoping someone can enlighten me on why this happens in the first place? I'm clueless at the moment.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...