Author Topic: Get rid of annoying "s in Add to Cart button on embedded site  (Read 6556 times)

Offline CalSci

  • Newbie
  • *
  • Posts: 6
  • Karma: +2/-0
    • View Profile
I have just installed AbanteCart on my already existing website as a back-end solution, replacing my old cart software. I have nearly everything the way I want it except two things. One of them is the [Qty:] and [Add to Cart] buttons have quotes in them, so they appear on the page as ["Qty:"] ["Add to Cart"]. After poking through the code for a few hours I figured out this annoying misuse of quotes is not a mistake but an artifact of the way that the variables are pulled from an XML file and then through several other subroutines. I've found that this exact same problem was in several other places in the same file, and in those places you used a function to strip the quotes out of the string, just not these. However the problem exists in a core file, which warns if edited will be overwritten when you update the cart to a new version, so I can't just fix it myself simply.

I would post exactly which files have the problem, and exactly where in the code the problem comes from so that you could fix this in 5 minutes, except that your forums have this rule that new accounts can't post URLs or code until we have sufficient karma. I could go make another thread and post some tips I've figured on how to customize AbanteCart to earn karma... but I can't do that because I can't post URLs or code. Who makes a forum to discuss software and bans new people from posting URLs and code??

The main piece of code is in the file js_product in the embed folder in the template folder in the default folder in the view folder in the store front folder.

The code in question echos the button text into some html which will be inserted into the page.

It pulls that text from the previous file, js, which is in the embed folder in the responses folder in the controller folder in the storefront folder.

That code sets the text to be the add to cart text which is gotten from the language storage of those variables. Elsewhere in that file there are subroutines which decode the string and strip out quotes. If you copied that code and applied it to this text before passing it on, the problem would be solved.

I would appreciate if you could take a few minutes to strip those quotes out for us. It makes our website look like it was written by idiots who don't know how to use quotes, when it's actually just a parsing error.

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 5751
  • Karma: +273/-2
    • View Profile
Re: Get rid of annoying "s in Add to Cart button on embedded site
« Reply #1 on: April 19, 2019, 01:09:57 AM »
Hi.
Language definitions like Add to Cart is without any quotes
Can you share a link where you embed products?

Offline CalSci

  • Newbie
  • *
  • Posts: 6
  • Karma: +2/-0
    • View Profile
Re: Get rid of annoying "s in Add to Cart button on embedded site
« Reply #2 on: April 22, 2019, 07:40:17 PM »
I cannot directly share a link, because the forums don't let new accounts do that. Below is a test page which has buttons on it.

calsci dot com slash motorcycleinfo slash test dot html

You can see the annoying quotation marks on that page.
« Last Edit: April 22, 2019, 10:39:37 PM by CalSci »

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 5751
  • Karma: +273/-2
    • View Profile
Re: Get rid of annoying "s in Add to Cart button on embedded site
« Reply #3 on: April 23, 2019, 03:02:07 AM »
Thank you. Now I see what are you talking about.
You need to change this file
https://github.com/abantecart/abantecart-src/blob/master/public_html/storefront/view/default/template/embed/js_product.tpl#L42
Replace
Quote
js_echo($text_qty);
with
Quote
echo $text_qty;

Offline CalSci

  • Newbie
  • *
  • Posts: 6
  • Karma: +2/-0
    • View Profile
Re: Get rid of annoying "s in Add to Cart button on embedded site
« Reply #4 on: April 23, 2019, 11:15:23 PM »
That fixed it, thank you.

Offline chucknp

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Re: Get rid of annoying "s in Add to Cart button on embedded site
« Reply #5 on: February 09, 2021, 10:18:04 PM »
Thank you!  Just had this problem, and it's now fixed.

 

Powered by SMFPacks Social Login Mod