Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17
  1. #11
    Join Date
    Feb 2012
    Location
    mostly harmless
    Posts
    1,809
    Plugin Contributions
    8

    Default Re: Bug with "buy now"

    Quote Originally Posted by raimond View Post
    Yes, it is random...when i do it again and again... You did set the Configuration - Product Listing and set Display Multiple Products Qty Box Status and Set Button Location to 0[/B]
    Yup, I did. My tests along with reading through the Zen Cart code is why it really does not make sense... I even tried guest vs. logged into an account (clean Zen Cart 1.5.x and clean Zen Cart 1.5.1 w/ USU)... Not saying you are not seeing the issue in your installation (you would not be here if you were not)... Just saying I have not yet been able to duplicate the behavior...

    Quote Originally Posted by raimond View Post
    ...
    Of course I downloaded the ZC151 from this site and run the zc_install. Downloaded and installed the latest version of "Ultimate URLs". No proxy. Tried local and on normal webhost. Chrome and Firefox tested, clean browser (clear cache and cookies) ...
    Had to ask, sometimes the "automated" install scripts bork things. What is the OS of the local computer?

    Link to the "test" site so we can see the generated HTML (and form fields - one per each "add to cart")? Any chance the form is being clicked upon before the browser finishes loading and rendering the HTML (such as on a slower server / connection)?

    Can you check and make sure the browser is set to not "save" form data? ($_POST is populated from a form... Maybe something in the browser is repopulating the form data with old data? Try running the browser with all add-on's disabled?)

    Quote Originally Posted by raimond View Post
    ...
    Didn't work (removing "&products_id=" from the URL)...same issue
    This means you are definitely going to want to check what data is being embedded in the forms (in particular the hidden products_id input field). The generated form + content comes from Zen Cart's core code unless a theme or module has been installed which overrides the code. The same is true for the code handling when "action=add_product" is one of the query parameters in a URL...
    Last edited by lhungil; 16 Oct 2013 at 04:49 PM.
    The glass is not half full. The glass is not half empty. The glass is simply too big!
    Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
    Zen Cart related projects maintained by lhûngîl : Plugin / Module Tracker

  2. #12
    Join Date
    Jul 2004
    Location
    The Netherlands, Wierden
    Posts
    430
    Plugin Contributions
    0

    Default Re: Bug with "buy now"

    I have tried now also with (besides chrome and firefox) also with a clean safari and ie (no extensions installled, never use them), but same.

    If you want I can install a clean zc151 demo and install later USEO...give you grant access to backend and ftp.

  3. #13
    Join Date
    Jul 2004
    Location
    The Netherlands, Wierden
    Posts
    430
    Plugin Contributions
    0

    Default Re: Bug with "buy now"

    go to http://demo.boekenhandel.eu/, just installed (clean install with demo data, by zc_install...no errors, after that SEO installed, no errors)

    DVD Movies - Action

    And buy something, Continu shopping....buy someting different in that categorie....Continu shopping....buy someting different in that categorie....Continu shopping....buy someting different in that categorie....Continu shopping....buy someting different in that categorie....Continu shopping....buy someting different in that categorie....etc.

    And it will go wrong (btw tested on windows 7 with almost all browsers)

  4. #14
    Join Date
    Feb 2012
    Location
    mostly harmless
    Posts
    1,809
    Plugin Contributions
    8

    Default Re: Bug with "buy now"

    Ahh, this is why providing full details is always so important. Note my earlier post. You have different settings then the ones I have been testing / talking about.

    It appears you have:
    Display Product Add to Cart Button: 1
    Display Multiple Products Qty Box: 0

    That said, I can see the problem. Looks like a bug is present in the Zen Cart code as "stock" Zen Cart is adding "http://site/index.php?main_page=index&cPath=3_10&sort=20a&products_id=12&action=buy_now&prod ucts_id=11" to the form action. Note the "double" inclusion of "products_id=". This can potentially cause issues depending upon how the web server handles the parameter being included twice.

    Give me a few minutes and I'll work up a patch to the Zen Cart core code to fix the issue for you. And thank your patience!
    Last edited by lhungil; 16 Oct 2013 at 08:02 PM.
    The glass is not half full. The glass is not half empty. The glass is simply too big!
    Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
    Zen Cart related projects maintained by lhûngîl : Plugin / Module Tracker

  5. #15
    Join Date
    Feb 2012
    Location
    mostly harmless
    Posts
    1,809
    Plugin Contributions
    8

    Default Re: Bug with "buy now"

    I've tested the following changes in "stock" Zen Cart 1.5.1 and Zen Cart 1.5.1 w/ USU (various different settings). Seems to work in my environments to remove the extra "products_id" Zen Cart is currently generating... Could you please try making the following changes to "/includes/modules/product_listing.php" and let me know if it works for you.

    Original Code (starting around line #127):
    Code:
                // hide quantity box
                if ($listing->fields['products_qty_box_status'] == 0) {
                  $lc_button = '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT, 'class="listingBuyNowButton"') . '</a>';
                } else {
                  $lc_button = TEXT_PRODUCT_LISTING_MULTIPLE_ADD_TO_CART . "<input type=\"text\" name=\"products_id[" . $listing->fields['products_id'] . "]\" value=\"0\" size=\"4\" />";
                }
              } else {
    // qty box with add to cart button
                if (PRODUCT_LIST_PRICE_BUY_NOW == '2' && $listing->fields['products_qty_box_status'] != 0) {
                  $lc_button= zen_draw_form('cart_quantity', zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=add_product&products_id=' . $listing->fields['products_id']), 'post', 'enctype="multipart/form-data"') . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($listing->fields['products_id'])) . '" maxlength="6" size="4" /><br />' . zen_draw_hidden_field('products_id', $listing->fields['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT) . '</form>';
                } else {
                  $lc_button = '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT, 'class="listingBuyNowButton"') . '</a>';
                }
    Patched Code (changes in red):
    Code:
                // hide quantity box
                if ($listing->fields['products_qty_box_status'] == 0) {
                  $lc_button = '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action', 'products_id')) . 'action=buy_now&products_id=' . $listing->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT, 'class="listingBuyNowButton"') . '</a>';
                } else {
                  $lc_button = TEXT_PRODUCT_LISTING_MULTIPLE_ADD_TO_CART . "<input type=\"text\" name=\"products_id[" . $listing->fields['products_id'] . "]\" value=\"0\" size=\"4\" />";
                }
              } else {
    // qty box with add to cart button
                if (PRODUCT_LIST_PRICE_BUY_NOW == '2' && $listing->fields['products_qty_box_status'] != 0) {
                  $lc_button= zen_draw_form('cart_quantity', zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action', 'products_id')) . 'action=add_product'), 'post', 'enctype="multipart/form-data"') . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($listing->fields['products_id'])) . '" maxlength="6" size="4" /><br />' . zen_draw_hidden_field('products_id', $listing->fields['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT) . '</form>';
                } else {
                  $lc_button = '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action', 'products_id')) . 'action=buy_now&products_id=' . $listing->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT, 'class="listingBuyNowButton"') . '</a>';
                }
    The glass is not half full. The glass is not half empty. The glass is simply too big!
    Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
    Zen Cart related projects maintained by lhûngîl : Plugin / Module Tracker

  6. #16
    Join Date
    Jul 2004
    Location
    The Netherlands, Wierden
    Posts
    430
    Plugin Contributions
    0

    Default Re: Bug with "buy now"

    Quote Originally Posted by lhungil View Post
    I've tested the following changes in "stock" Zen Cart 1.5.1 and Zen Cart 1.5.1 w/ USU (various different settings). Seems to work in my environments to remove the extra "products_id" Zen Cart is currently generating... Could you please try making the following changes to "/includes/modules/product_listing.php" and let me know if it works for you.
    GREAT , that works!

    Okay core-modification, but most important that it works.

    Thanks

    is this a ZC bug or USEO bug?

  7. #17
    Join Date
    Feb 2012
    Location
    mostly harmless
    Posts
    1,809
    Plugin Contributions
    8

    Default Re: Bug with "buy now"

    I'd consider it a Zen Cart bug... For two main reasons:

    1) As the products_id from a previous action ends up being left in $_GET when the current action is occurring on a different products_id...

    2) In most Apache + PHP situations defining a query key more than once results in $_GET only containing the last one defined in the URL (farthest right). Some programming languages handle this differently, but the general rule is to never include a query key twice (one can always use an array if they intend to pass two values for one key).

    Now in defense of the Zen Cart development team... Because the last key in the URL is the present in $_GET... This is not a bug which will show up easily when performing functionality testing... Especially since the form will act as expected...

    "Ultimate URLs" does not expect to be passed duplicate query keys (see #2 above)... Internally some legacy code performs a "sort" of the query terms (key+value) when processing the request. The means the sort may change the order "duplicate" query terms are processed (and internally "Ultimate URLs" follows the same convention as PHP and only keeps the last encountered query key).

    So in conclusion the cause of the erratic behavior is a combination of how "Ultimate URLs" handles query terms + the "bug" in Zen Cart.

    IMHO the best long term solution would be to fix the Zen Cart code to not include the duplicate query key. This would avoid any possibility of a Web Server, PHP interpreter, or third party code possibly selecting the wrong query key+value combination to use when adding a product to the shopping cart. It also may not be a bad idea to look into using $_POST to pass the necessary data instead of $_GET.

    When I get some time I'll probably take a look at the pre-release Zen Cart 1.6 code. If no one has already submitted a patch I'll contribute one for this file.
    Last edited by lhungil; 17 Oct 2013 at 06:34 PM.
    The glass is not half full. The glass is not half empty. The glass is simply too big!
    Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
    Zen Cart related projects maintained by lhûngîl : Plugin / Module Tracker

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Extra "Buy Now" buttons for Buy 1, Buy 2, Buy 3, Buy 4 etc...
    By AndyVI in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 20 Mar 2011, 06:15 PM
  2. How to: new/featured main page - "buy now/details" change to "design" with attributes
    By ladybugmom in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 18 Jan 2011, 11:23 AM
  3. Replies: 16
    Last Post: 21 Apr 2010, 07:38 PM
  4. "more info" instead of "buy now" (even with no attributes)
    By p m in forum Setting Up Categories, Products, Attributes
    Replies: 8
    Last Post: 2 Aug 2007, 03:24 AM
  5. Force "more info" instead of "buy now" (even with no attributes)
    By thechoyboy in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 31 Oct 2006, 12:37 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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR