Show Posts

Topics - CalSci

Pages: [1]
Shipping Modules / USPS Girth Calculation
« on: May 02, 2019, 06:35:09 AM »
In the file:
cart slash extensions slash default_usps slash storefront slash model slash extension slash default_usps.php

The following line is incorrect:

         // Calculate girth based on usps calculation
         $xml .= '      <Girth>' . (round(((float)$this->config->get('default_usps_length') + (float)$this->config->get('default_usps_width') * 2 + (float)$this->config->get('default_usps_height') * 2), 1)) . '</Girth>';

Girth is 2*width+2*height. USPS does use length+girth often, but that is not the same thing. Also that formula only works if length is longer than width and height, otherwise it needs to sort the longest side out of the formula.

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.

Pages: [1]

Powered by SMFPacks Social Login Mod