Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2006
    Posts
    21
    Plugin Contributions
    0

    Default product_id parameter in URL twice, after adding items to cart?

    I think I might have found a bug? With a clean install of zen cart 1.3.0.1.
    I've noticed with my settings I end up with incorrect URL's on the product listing page, it's showing an extra product_id parameter. And it is conflicting with my other mods because they're expecting the product_id parameter to be in the URL only once.

    Admin settings:

    My store
    Display Cart After Adding Product = false

    Product listings
    Display Multiple Products Qty Box Status and Set Button Location = 0


    After adding a new item to cart by clicking on "buy now" button on product listing page you're redirected back to the same page you where on when you clicked buy now button, but the urls of all the other buy now buttons has the parameter "product_id" in it twice. This extra "product_id" seems to come from the function zen_get_all_get_params which builds the redirct URL, I think what's happening is that the this function is throwing the product_id back into the url, and then the product_id outside of the fuction is added in a second time to build the url, it seems to be throwing off my Ultimate SEO URLs mod, and I think it even was flaking out even without the mods too, if you'd click on another buy now button the same page again you'd end up with multiple quantities of the first item you selected. I get a headache looking at the zen cart functions and trying to fix them so I'm just going to make my own get all parameter's function and use that for this situation, unless someone has a better easier idea?

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: product_id parameter in URL twice, after adding items to cart?

    Do you have an URL where we can see this? I cannot reproduce this error ...

    NOTE: v1.3.0.2 was just released, btw and you should upgrade to that ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Jun 2006
    Posts
    21
    Plugin Contributions
    0

    Default Re: product_id parameter in URL twice, after adding items to cart?

    I don't have a URL it's on a development server, but if you follow my settings exactly, then you'll see it. You have to have the two settings set the way I have them. I did this will a 100% clean install.

    I know what the problem is. Your function that get's all the url GET parameters, is also getting the product_id , and when you build the "buy now" links you're adding the product_id in a second time.

    I fixed this problem and an SEO problem at the same time. I'll explain. it's not good to have user actions be simple hyperlinks that spiders can follow, they should be buttons so that the spiders won't follow them. I figured this out after whatching my own search engine spider crawl the site and fetch all these nasty URLS with parameters on it, that it shouldn't even be grabing for example the
    buy now button
    the tell a friend button
    the write a review button
    if you have the book type module installed you'll have
    the author links
    the publisher links

    none of these the search spiders should be following, so I'm going through and hastly changing these, I'll write a pretty function later when I have time but what I did was turn all the links into form get requests I'll show you.

    PHP Code:
             $return_button =
                
    '<form id="notify" name="notify" method="get" action="index.php">
                <input name="main_page" type="hidden" value="product_book_info" />
                <input name="cPath" type="hidden" value="' 
    $_GET['cPath'] . '" />
                <input name="products_id" type="hidden" value="' 
    $product_id '" />
                <input name="action" type="hidden" value="notify" />
                <input type="submit" value="Notify me" class="notify" />
                </form><br/>' 
    MORE_INFO_TEXT
    If you're wondering where I use this, I use it in place of the "sold" button, so if something is soldout people can click on the product updates link instead. This will help keep the spiders from following links they shouldn't but still sends a get request like a normal link so as not to break the other code that is looking for $_GET's etc. I know there are HTML tags to tell robots not to follow one link or another, but I've found that only some of the robots listen to robots.txt and these other tags and meta tags etc. I don't know of any spider following forms hahaa.

    If you know a better way to covert hyperlinks into simple form links let me know.

    If you just want to fix the url, you could probably change the zen get all parameter's function so that it strips out the product_id parameter if the action is "buy_now" ? just a guess. But I don't have time to play with that right now.

  4. #4
    Join Date
    Jun 2006
    Posts
    21
    Plugin Contributions
    0

    Default Re: product_id parameter in URL twice, after adding items to cart?

    Don't have time right now to re-intergrate all the mods into a new version just did that last week with 1.3.0.1. We're only going to update every few months from now on.

    Do you have a link to a changelogs so I can see what is new between version, or do you have SVN/CVS access that's public?

  5. #5
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: product_id parameter in URL twice, after adding items to cart?

    Check the function ... you can pass it the things to drop from the paramaters as well as what to add ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  6. #6
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: product_id parameter in URL twice, after adding items to cart?

    NOTE: download the v1.3.0.2 and the change log and what's new is in there ...

    You really do want these fixes now rather than later ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  7. #7
    Join Date
    Jun 2006
    Posts
    21
    Plugin Contributions
    0

    Default Re: product_id parameter in URL twice, after adding items to cart?

    Ok thanks Ajeh, yeah I'll take a closer look at the function, that's handy.

    So this means give me all the parameter's back but the action right?
    PHP Code:
    zen_get_all_get_params(array('action')) 
    So then this would mean give me everything back but NOT the product's id?
    PHP Code:
    zen_get_all_get_params(array('products_id')) 
    Ok I just tested it out, I get it cool.

    Now I'm wondering, how would you block more then one parameter form being returned? So say you didn't want the action AND the product id to NOT be returned?

    what would be handy for me is to make a loop that dynamcially creates my form <input> elements by what's returned from the zen get parameters function.
    I'm working on that one now. Unless you have an easier way to dynamically generate the form buttons?

    The only bad thing about the form buttons is that it creates a lot more code for the spiders to have to sift through, and I haven't tested it yet, but I"m not even sure if it will come out as XHTML either? I wonder if all the form code will dilute the SEO results, because the keyword density would be lower? I bet keyword density only deals with the visible text? I wonder about this. Either way I know I don't want the spiders linking to my pages with buy_now in the url on one page and on another page it's productname-p-1243.html causing duplicate content penalites etc.

    Anybody else have any thoughts on this. It's funny I really didn't think about it till I started crawling my own site with my own search spiders, then you see the problems right away. So for a 40,000 product site, it would have 500,000 links for a spider to have to follow as oppose to 45,000 if you do everything you can to avoid that.

    The spider's will be adding items to your shopping cart hahaha I think too, which could make for huge number of noise links on your site? Unless there is some code to prevent this that I missed? I know robots are blocked from creating sessions, but what about following hyperlinks to add items to cart? that would be bad if not.

  8. #8
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: product_id parameter in URL twice, after adding items to cart?

    /me peeks over at the neat little toy in the Admin ... Tools ... Developer's Tool Kit ...

    Gee ... wonder what would happen if I past in the bottom input box:

    zen_get_all_get_params(array
    And then searched the whole Catalog ...

    wow!! ... lookie at all the neat code come up and usage ideas ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

 

 

Similar Threads

  1. Weird URL:s after adding products to cart.
    By kazie in forum General Questions
    Replies: 1
    Last Post: 18 Jun 2010, 07:28 PM
  2. Cart Empty After Adding Items? Things Disappearing!
    By lhardie in forum General Questions
    Replies: 6
    Last Post: 19 Aug 2009, 05:29 PM
  3. Index Listing Items Appear Twice after upgrading
    By ptoly in forum Upgrading from 1.3.x to 1.3.9
    Replies: 11
    Last Post: 14 Jun 2009, 02:01 AM
  4. Shopping Cart not showing up after adding items
    By russa2 in forum General Questions
    Replies: 3
    Last Post: 30 Jan 2009, 03:25 PM
  5. Adding items to cart via URL
    By chachix in forum General Questions
    Replies: 5
    Last Post: 28 Feb 2008, 08:28 PM

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