osCmax v2.5 User Manual
Results 1 to 7 of 7

products with attributes. The url in the shopping cart breaks site.

This is a discussion on products with attributes. The url in the shopping cart breaks site. within the osCommerce 2.2 Modification Help forums, part of the osCommerce 2.2 Forums category; Hi guys, I have a heavily modded oscommerce installed. I have SEO friendly URLS, extra product fields, and the STS ...

      
  1. #1
    New Member
    Join Date
    Feb 2009
    Posts
    5
    Rep Power
    0


    Default products with attributes. The url in the shopping cart breaks site.

    Hi guys,

    I have a heavily modded oscommerce installed. I have SEO friendly URLS, extra product fields, and the STS package.

    I've noticed that when I add a product which has attributes associated to it, when it's added to my basket the link when hovered over reads as this:

    http://www.mywebsite.co.uk/catalog/product...ts_id=2{4}3{3}6

    If i try to continue shopping or click this link, i get a blank page with the following error on it:

    1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '{4}3{3}6 and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pe' at line 1

    SELECT pef.products_extra_fields_status as status, pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value FROM products_extra_fields pef LEFT JOIN products_to_products_extra_fields ptf ON ptf.products_extra_fields_id=pef.products_extra_fi elds_id WHERE ptf.products_id=2{4}3{3}6 and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='1') ORDER BY products_extra_fields_order

    [TEP STOP]

    All other products I add, which do not have any attributes (e.g. a memory size on a drop down), will be fine and when clicked go to the correct place...... Can you help?

    From looking at the code it seems like a extra fields issue - however, I'm not actively adding extra fields right now. I swear it must be a conflict somehow - could be related to Ultimate SEO?

    I could just never add any products with attributes but that might not help me out.

  2. #2
    New Member
    Join Date
    Feb 2009
    Posts
    5
    Rep Power
    0


    Default Re: products with attributes. The url in the shopping cart breaks site.

    If my query is too vague please visit the live site and have a look.

    Home - Test Platform

    If you add a product to the basket which has product attributes, and then a product without them.

    One without attributes:
    http://www.woodleysnapshot.co.uk/catalog/f...below-p-11.html

    One with attributes:
    http://www.woodleysnapshot.co.uk/catalog/m...0-32mb-p-2.html

    Add them both to the basket and navigate to the shopping cart page. Try clicking on the Fire down below product, there are no problems. Go back to the matrox product, and click on it in the cart.... you get a funny error.

    It appears the url is appended with funny numbers at the end should the product contain attributes, and the site doesnt like this link.

    I'm wondering if it's a .htaccess issue affected by the SEO friendly contribution, or if it's something wrong with the product_info page. I found this code in product_info which relates to this problem...

    HTML Code:
    <?php
    
              // START: Extra Fields Contribution v2.0b - mintpeel display fix
    
                          $extra_fields_query = tep_db_query("
                          SELECT pef.products_extra_fields_status as status, pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value
                          FROM ". TABLE_PRODUCTS_EXTRA_FIELDS ." pef
                 LEFT JOIN  ". TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS ." ptf
                ON ptf.products_extra_fields_id=pef.products_extra_fields_id
                WHERE ptf.products_id=". (int) $products_id ." and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='".$languages_id."')
                ORDER BY products_extra_fields_order");
    
      while ($extra_fields = tep_db_fetch_array($extra_fields_query)) {
            if (! $extra_fields['status'])  // show only enabled extra field
               continue;
            echo '<tr>
          <td>
          <table border="0" width="100%" cellspacing="0" cellpadding="2px"><tr>
          <td align="right" vallign="middle">';
            echo '<img src="http://www.woodleysnapshot.co.uk/catalog/images/' .$extra_fields['value'].'.jpg "></tr>
          </table>
          </td>
          </tr>'; 
      }
           // END: Extra Fields Contribution - mintpeel display fix
    ?>

  3. #3
    jpf
    jpf is offline
    osCMax Testing Team
    jpf's Avatar
    Join Date
    Sep 2003
    Location
    Manitoba, Canada
    Posts
    2,699
    Rep Power
    22


    Default Re: products with attributes. The url in the shopping cart breaks site.

    First of all turn off SEO and in htacess. Try it out - maybe your contribs are doing this non-strandard.
    JPF - osCMax Fourm Moderator - To contact, post on the forum or click here
    Try out our osCMax at: Live Catalog Demo
    Limited access Admin: Live Admin Demo
    Feel free to add products they way you want and then purchase them -=+=- Sorry nothing will be billed or shipped!

  4. #4
    New Member
    Join Date
    Feb 2009
    Posts
    5
    Rep Power
    0


    Default Re: products with attributes. The url in the shopping cart breaks site.

    Hey - i just gave that a go, but it did not work. It carried on doing the same thing.

    So i can rule out the ultimate seo.... I also stripped out the extra fields code from product_info.php but the same error appeared. It's getting that from somewhere else then.

    hmmmm........

  5. #5
    osCMax Developer

    michael_s's Avatar
    Join Date
    Jul 2002
    Location
    Phoenix, AZ
    Posts
    19,907
    Rep Power
    568


    Default Re: products with attributes. The url in the shopping cart breaks site.

    Code:
    ?options={4}3{3}6
    Those are normal and it is how osC keeps track of attributes in the url.

    What is not normal is how your site is handling it, the mysql error. There is a problem in a query somewhere, most likely a mod you made.

    See how it is supposed to work here:
    osCMax v2.0 RC3.0.3 : Welcome to AABox.com's osCMax v2.0 - change this in /english/index.php

    There are only 2 products, add one of each. One has attributes, one doesn't. Note the url for the one with attributes. Click away and all works fine.
    Michael Sasek
    osCMax Developer


    osCmax Installation Service
    - Have our professionals install osCmax on your server - same day service!
    osCmax 2.5 User Manual - the must have beginners guide to osCmax v2.5

    Stay Up To Date with everything osCMax:
    Free osCmax Newsletters - Security notices, New Releases, osCMax News
    osCmax on Twitter - Up to the minute info as it happens. Know it first.

    osCmax Documentation

  6. #6
    New Member
    Join Date
    Feb 2009
    Posts
    5
    Rep Power
    0


    Default Re: products with attributes. The url in the shopping cart breaks site.

    Thanks for the info - is it possible to localise key pages where the error could be stemming from so I can review the code inside of them?

    I downloaded a loaded copy of oscommerce which already had a set of contribs on, all of which are v. useful. However this problem occured from the start.

  7. #7
    New Member
    Join Date
    Feb 2009
    Posts
    5
    Rep Power
    0


    Default Re: products with attributes. The url in the shopping cart breaks site.

    I fixed it!!! I'm impressed with myself.

    I did something that i probably should've done in the first instance. I copied the sql query and did a find of the catalog folder.

    It popped up the includes/modules/products_extra_fields.php file and i went in there.

    I found that the query on my product_info.php page was different. So i pasted this query over the top of what was in products_extra_fields.php

    Before:

    HTML Code:
    $sql = "SELECT pef.products_extra_fields_status as status, pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value FROM ". TABLE_PRODUCTS_EXTRA_FIELDS ." pef LEFT JOIN  ". TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS ." ptf ON ptf.products_extra_fields_id=pef.products_extra_fields_id WHERE ptf.products_id=".$HTTP_GET_VARS['products_id']." and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='".$languages_id."') ORDER BY products_extra_fields_order";
    After:

    HTML Code:
    $sql = "SELECT pef.products_extra_fields_status as status, pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value FROM ". TABLE_PRODUCTS_EXTRA_FIELDS ." pef LEFT JOIN  ". TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS ." ptf ON ptf.products_extra_fields_id=pef.products_extra_fields_id WHERE ptf.products_id=". (int) $products_id ." and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='".$languages_id."') ORDER BY products_extra_fields_order";
    It did not like the ptf.products_id as $HTTP_GET_VAR for some reason, and i replaced that with an int..... I don't understand the impact but know it now works.

    I always hate when someone gets a fix but doesnt share. So I hope this helps someone who might have the same problem.

Similar Threads

  1. Attributes disappearing when quantity is updated in shopping cart.
    By michael_s in forum New osCommerce Contributions
    Replies: 2
    Last Post: 11-15-2008, 10:32 PM
  2. Replies: 4
    Last Post: 06-14-2007, 09:43 AM
  3. How to put the product attributes box in the shopping cart?
    By loba in forum osCmax v1.7 Discussion
    Replies: 0
    Last Post: 03-23-2005, 09:59 PM
  4. Losing products from shopping cart?
    By angelbud in forum osCommerce 2.2 Modification Help
    Replies: 3
    Last Post: 05-18-2004, 02:08 PM
  5. 2 products by page in shopping cart
    By EPierre in forum osCommerce 2.2 Installation Help
    Replies: 1
    Last Post: 12-01-2002, 08:57 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •