Page 1 of 3 123 LastLast
Results 1 to 10 of 27
  1. #1
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Pinterest urlencode

    has anybody encountered issues with pinterest and urlencode?

    basically items will pin just fine.

    but if someone clicks on the link in pinterest they are directed to:

    index.php?main_page=product_info&products_id=285

    instead of:

    index.php?main_page=product_info&products_id=285

    I have always used urlencode for the url in the pinterest button. Until recently that worked fine. Now obviously it gets a product not found message. The various modules out there seem to do exactly the same thing so this can't be unique to me.

    Any thoughts

  2. #2
    Join Date
    Nov 2007
    Location
    Woodbine, Georgia, United States
    Posts
    4,009
    Plugin Contributions
    61

    Default Re: Pinterest urlencode

    The bulk of the problem is pinterest.... this

    <a href="http://pinterest.com/pin/create/button/?url=<?php echo zen_href_link($current_page, ($includeCPath ? 'cPath=' . zen_get_generated_category_path_rev(zen_get_products_category_id($_GET['products_id'])) . '&' : '') . 'products_id=' . $_GET['products_id'], 'NONSSL', false); ?>

    generates the correct link

    http://pinterest.com/pin/create/########...e=product_info&products_id=685&description=Red+POW%2FMIA+Flag+-+3+x+5+ft+Polyester%2C+Flags+%7C+Banners+%7C+Flag+Poles&media=https%3A%2F%2Fdoma in.com%2Fimages%2Fpowredmia.jpg

    But then Pinterest strips the link to
    https://domain.com/index.php?main_page=product_info
    upon saving

    However if you send them
    https://domain.com/index.php?main_page=product_info&amp;cPath=9&amp;products_id=549

    then that's what the publish...... thus broken

    ~Melanie
    PRO-Webs, Inc. :: Recent Zen Cart Projects :: Zen Cart SEO – 12 Steps to Success
    **I answer questions in the forum, private messages are NOT answered. You are welcome to contact us via our website for professional engagements.

  3. #3
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: Pinterest urlencode

    Thanks melanie,

    Yes it seems like a strange situation that is for sure. At the moment I have a work around in which I am encoding the url and then using str_replace to partially un-encode it. SO basically sending a mixed string.

    And perhaps you can advise me.

    One of my issues is that I am using the canonical link as the base of those urls. So, when I look at the canonical link in the source. Which I have to confess I have never paid much attention to but rather assumed it was correct. It reads as follows for a product:

    http://domain.com/index.php?main_pag...roducts_id=513

    which surely is actually wrong? it should show '&' instead of '&amp;' at that point, shouldn't it? That canonical address doesn't actually exist.

    This is coming out of zen_href_link so it will apply to your code too. Which is why I am having to use str_replace to turn that '&amp;' back into a '&' before putting it in the pinterest link. Otherwise the '&' is effectively double encoded. Then it works .....

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

    Default Re: Pinterest urlencode

    In HTML and XHTML you should not use a lone "&" as this signals the start of an HTML/XHTML entity. Adding the "&amp;" is actually the correct syntax for the URL. The browser will correctly parse the page and render the "&amp;" entity into a text "&" for display and links.

    I do not use Pinterest at this time... But if you are entering the URL in a text field on a form, Pintrest's code may be failing to encode the "&" symbol (if you use "&" or "&amp;" in a URL it will treat those as a query delimiter) before sending the request. If you use "%26" in place of the "&" it will not be interpreted as a delimiter.

    Have you tried urlencoding the the link before submitting? So sending:
    Code:
    http://pinterest.com/pin/create/button/?url=http%3A%2F%2Fdomain.com%2Findex.php%3Fmain_page%3Dproduct_info%26products_id%3D513
    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. #5
    Join Date
    Nov 2007
    Location
    Woodbine, Georgia, United States
    Posts
    4,009
    Plugin Contributions
    61

    Default Re: Pinterest urlencode

    PRO-Webs, Inc. :: Recent Zen Cart Projects :: Zen Cart SEO – 12 Steps to Success
    **I answer questions in the forum, private messages are NOT answered. You are welcome to contact us via our website for professional engagements.

  6. #6
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: Pinterest urlencode

    The issue is when you do encode.

    The issue comes from the fact that this:

    index.php?main_page=product_info&amp;cPath=10_23&amp;products_id=167

    is not the same as this

    index.php?main_page=product_info&amp;cPath=10_23&products_id=167

    In zen cart. Don't believe me? Try it out. ( Yes I know that they should be ! )

  7. #7
    Join Date
    Nov 2007
    Location
    Woodbine, Georgia, United States
    Posts
    4,009
    Plugin Contributions
    61

    Default Re: Pinterest urlencode

    Quote Originally Posted by niccol View Post
    The issue is when you do encode.

    The issue comes from the fact that this:

    index.php?main_page=product_info&cPath=10_23&products_id=167

    is not the same as this

    index.php?main_page=product_info&cPath=10_23&products_id=167

    In zen cart. Don't believe me? Try it out. ( Yes I know that they should be ! )
    No you are correct as I have stated =)
    the end issues is it doesn't matter because Pinterest strips it if (&amp;) is NOT sent and displays (&amp:) in the url if you do

    Pinterest problem
    PRO-Webs, Inc. :: Recent Zen Cart Projects :: Zen Cart SEO – 12 Steps to Success
    **I answer questions in the forum, private messages are NOT answered. You are welcome to contact us via our website for professional engagements.

  8. #8
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: Pinterest urlencode

    yes, it is a pinterest problem.

    But you can get around it by using str_replace because you need to have %26 in what is sent. Not '%26amp%3B' . Then it does work and doesn't strip the end off the url. I have it working on one of my sites ( the only on that doesn't use uri rewriting) As lhungil says it has to do with the use of characters as delimiters. In this case not so much to do with HTML but rather to do with the way pinterest parses the URL that is in their link. It looks like it uses $amp; to explode the link which means that if it appears somewhere else it is going to cause issues. Sort of like having commas in a csv file.

    What works for me is :

    Code:
    urlencode(str_replace('&amp;','&',$canonicalLink))
    So this is the whole section of the link which works.

    Code:
    ...url=http%3A%2F%2Fdomain.com%2Findex.php%3Fmain_page%3Dproduct_info%26products_id%3D341&amp;media...




    But, while I have your attention, Melanie. What is your opinion of the issue with the canonical links that Zen produces? I mean, if I copy and paste the canonical link for a product_info page into a browser it shows me 'product not found' . That can't be great can it?

    You know much more about that search engine world than I do, so?

  9. #9
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: Pinterest urlencode

    The issue comes from the fact that this:

    index.php?main_page=product_info&cPath=10_23&products_id=167

    is not the same as this

    index.php?main_page=product_info&cPath=10_23&amp;products_id=167

    In zen cart.

    That is what I meant. The get parameters of these urls are entirely different and as the page is created from the get parameters then the pages are entirely different. So, why is the canonical link that is created to the one that has the 'wrong' get parameters?

    Attached is a screenshot that show pretty clearly that the get parameters are interpreted differently.
    Attached Images Attached Images  
    Last edited by niccol; 11 Feb 2013 at 10:11 PM.

  10. #10
    Join Date
    Nov 2007
    Location
    Woodbine, Georgia, United States
    Posts
    4,009
    Plugin Contributions
    61

    Default Re: Pinterest urlencode

    Quote Originally Posted by niccol View Post
    yes, it is a pinterest problem.

    But you can get around it by using str_replace because you need to have %26 in what is sent. Not '%26amp%3B' . Then it does work and doesn't strip the end off the url. I have it working on one of my sites ( the only on that doesn't use uri rewriting) As lhungil says it has to do with the use of characters as delimiters. In this case not so much to do with HTML but rather to do with the way pinterest parses the URL that is in their link. It looks like it uses $amp; to explode the link which means that if it appears somewhere else it is going to cause issues. Sort of like having commas in a csv file.

    What works for me is :

    Code:
    urlencode(str_replace('&','&',$canonicalLink))
    So this is the whole section of the link which works.

    Code:
    ...url=http%3A%2F%2Fdomain.com%2Findex.php%3Fmain_page%3Dproduct_info%26products_id%3D341&media...




    But, while I have your attention, Melanie. What is your opinion of the issue with the canonical links that Zen produces? I mean, if I copy and paste the canonical link for a product_info page into a browser it shows me 'product not found' . That can't be great can it?

    You know much more about that search engine world than I do, so?
    No, it is still striped by pinterest in the actual pin
    PRO-Webs, Inc. :: Recent Zen Cart Projects :: Zen Cart SEO – 12 Steps to Success
    **I answer questions in the forum, private messages are NOT answered. You are welcome to contact us via our website for professional engagements.

 

 
Page 1 of 3 123 LastLast

Similar Threads

  1. Pinterest Rich Pins
    By OLCS in forum All Other Contributions/Addons
    Replies: 8
    Last Post: 1 Jun 2015, 02:02 AM
  2. creinold Pinterest Button Addon
    By creinold in forum All Other Contributions/Addons
    Replies: 97
    Last Post: 2 Jan 2015, 10:02 PM
  3. v151 Help with pinning to Pinterest
    By AnnieG in forum Basic Configuration
    Replies: 2
    Last Post: 7 Mar 2014, 03:43 PM
  4. v150 Pinterest Verification Help
    By ReRetail in forum General Questions
    Replies: 1
    Last Post: 5 Jun 2013, 04:53 PM
  5. v150 Numinix Pinterest mod
    By pityocamptes in forum All Other Contributions/Addons
    Replies: 3
    Last Post: 24 Apr 2012, 08:03 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