Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
simon1066
This may be a bug/omission but given the complexities of this mod I wouldn't be surprised if I just didn't understand.
When adding a product to the cart my config settings are such that the cart is not displayed and I instead get a popup saying for example:
HTML Code:
'Men's Red Shoe' was added to your basket
If I do the same with a product priced by attributes and SBA, I get:
HTML Code:
was added to your basket
eventually I found that in includes\extra_cart_actions\stock_by_attributes.php
around line 1064
Code:
// display message if all is good and not on shopping_cart page
if (DISPLAY_CART == 'false' && $_GET['main_page'] != FILENAME_SHOPPING_CART && $messageStack->size('shopping_cart') == 0) {
$messageStack->add_session('header', ($_SESSION['cart']->display_debug_messages ? 'FUNCTION ' . __FUNCTION__ . ': ' : '') . SUCCESS_ADDED_TO_CART_PRODUCT, 'success');
needed to be changed to
Code:
// display message if all is good and not on shopping_cart page
if (DISPLAY_CART == 'false' && $_GET['main_page'] != FILENAME_SHOPPING_CART && $messageStack->size('shopping_cart') == 0) {
$messageStack->add_session('header', ($_SESSION['cart']->display_debug_messages ? 'FUNCTION ' . __FUNCTION__ . ': ' : '') . '\'' . zen_get_products_name($_POST['products_id']) . '\'' . SUCCESS_ADDED_TO_CART_PRODUCT, 'success');
so that the zen_get_products_name function is called when adding a 'SBA' product to the cart.
Haven't yet dug into the likely cause for the "difference", but could you identify the version of ZC in which this occurred and any other plugins that may be associated? I'm curious if there is an issue with loading sequence of the define or some other information that might cause that minor difference (ie. If perhaps there was a change in the shopping_cart class that did not get picked up into the extra_cart_actions file.)
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Sure,
v1.5.5.f (PHP 7.1.9)
SBA (latest from Github)
CEON
CSS/JS Loader
DPU
Flexible Attributes
GDPR4ZC
Lazy Loader
SNAF
User Tracking
Zen Magnific
Dynamic Filter
OPC
Structured Data
Template: modified Stirling Grand
I used this code from my \classes\shopping_cart.php as a guide
Code:
// display message if all is good and not on shopping_cart page
if (DISPLAY_CART == 'false' && $_GET['main_page'] != FILENAME_SHOPPING_CART && $messageStack->size('shopping_cart') == 0) {
$messageStack->add_session('header', ($this->display_debug_messages ? 'FUNCTION ' . __FUNCTION__ . ': ' : '') . '\'' . zen_get_products_name($_POST['products_id']) . '\'' . SUCCESS_ADDED_TO_CART_PRODUCT, 'success');
but I note now that this is not part of the v1.5.5f stock install, and I'm not entirely sure which mod made that change. The default behaviour would be to display
HTML Code:
Successfully added Product to the cart ...
with no mention of the product name.
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Edit: cancel this post I was in error
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
simon1066
Edit: cancel this post I was in error
Darn, and I didn't load a forum page to know what was posted here. :) anyways, I had come across the same conclusion about the difference between a default install and the change(s) made to this site. The product name is not part of the default install, but at least you were able to find the area of code causing the difference. Good job and thank you for posting your solution. If only the associated plugin could be identified then the solution could be better discussed. :)
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Yes, this will teach me not to make notes. Looking at my archives it seems that it was me, not a mod, that made the change to shopping_cart.php. No doubt I've reached the age where I should stop reyling on my memory. :)
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
simon1066
Yes, this will teach me not to make notes. Looking at my archives it seems that it was me, not a mod, that made the change to shopping_cart.php. No doubt I've reached the age where I should stop reyling on my memory. :)
Notes of some type or comparison back to the original are always good. :) regardless you approached it from a direction of uncertainty. I too had come to the same conclusion that the change had been made for some other reason. Ideally such a change would use a method that would substitute the product's name into the defined string rather than always prepending it to the remainder of the text as not all languages place the product's name first in such a sentence. May make a code suggestion even if the content wouldn't resolve to what was demonstrated...
Regardless of age, keep up with what you're doing. Again, thank you for pointing out an area that might need some touching when using SBA and one of those plugins or just for more specificity of what was added to the cart.
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
mc12345678
Notes of some type or comparison back to the original are always good. :) regardless you approached it from a direction of uncertainty. I too had come to the same conclusion that the change had been made for some other reason. Ideally such a change would use a method that would substitute the product's name into the defined string rather than always prepending it to the remainder of the text as not all languages place the product's name first in such a sentence. May make a code suggestion even if the content wouldn't resolve to what was demonstrated...
Regardless of age, keep up with what you're doing. Again, thank you for pointing out an area that might need some touching when using SBA and one of those plugins or just for more specificity of what was added to the cart.
Thank you for the vote of confidence. I see what you mean re the language files. So, although it's not directly SBA related, in case anyone wants to display the product name in the 'added to cart' message; I've removed my edits to includes/extra_cart_actions/stock_by_attributes.php and includes/classes/shopping_cart.php and instead in includes/languages/english.php made the following change:
Code:
define('SUCCESS_ADDED_TO_CART_PRODUCT', 'Successfully added Product to the cart ...');
Code:
define('SUCCESS_ADDED_TO_CART_PRODUCT','\'' . zen_get_products_name($_POST['products_id']) . '\' was added to your basket');
used 'basket' for the UK and added quotes around the product name mainly because this site is for artwork and I like to highlight the name.
Edit: As I have moved the message to the top right corner of my site (just below the cart icon) I truncated it by removing the ...
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Zen Cart version = 1.55d
SBA Version 1.5.4 for Zen Cart Version 1.5.5d
We have a problem with rounding of prices of products with attributes
One of our attributes has a price of €23.5849 excl 6% VAT ( 23.5849 * 1.06 = €24,999994 )
the SBA lists a incl price of €25,00
however if we add one to the shopping-cart it is listed as €24,99
Please advise us to what possible solutions there are
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
Marc Boon
Zen Cart version = 1.55d
SBA Version 1.5.4 for Zen Cart Version 1.5.5d
We have a problem with rounding of prices of products with attributes
One of our attributes has a price of €23.5849 excl 6% VAT ( 23.5849 * 1.06 = €24,999994 )
the SBA lists a incl price of €25,00
however if we add one to the shopping-cart it is listed as €24,99
Please advise us to what possible solutions there are
This issue is not directly related to SBA, but is something associated with internal calculations of ZC and possibly/likely separate at least what I consider incorrect usage/application of product VAT pricing. I am not a tax qualified individual, so please take this with a grain of salt. As can be seen, the non-taxed cost of the product is shown as 23.5849... Unless that is the cost of a single item that was purchased in bulk, I find it difficult to say that anyone was able to provide a currency amount that resulted in that price. Yes, it makes the final price look good/right, but in a way it doesn't make sense as anyone purchasing the product without VAT will not pay that amount. They will pay either more or less than the identified per quantity product unless they purchase at least a hundred of them.
So, some fixes that have been suggested/applied are either a code change (there was something posted late last year if I remember correctly, but would have to search for it), a slight modification of the tax value (say 5.9999% but display only 6%), or an expansion on the data stored to include one additional decimal place, to name a few. I think I've seen a few others, but usually it is dependent on what is being seen and the specific product price. There are a few specific prices/tax rates that result in such "loss" of a penny...
1 Attachment(s)
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
mc12345678
This issue is not directly related to SBA, but is something associated with internal calculations of ZC and possibly/likely separate at least what I consider incorrect usage/application of product VAT pricing. I am not a tax qualified individual, so please take this with a grain of salt. As can be seen, the non-taxed cost of the product is shown as 23.5849... Unless that is the cost of a single item that was purchased in bulk, I find it difficult to say that anyone was able to provide a currency amount that resulted in that price. Yes, it makes the final price look good/right, but in a way it doesn't make sense as anyone purchasing the product without VAT will not pay that amount. They will pay either more or less than the identified per quantity product unless they purchase at least a hundred of them.
So, some fixes that have been suggested/applied are either a code change (there was something posted late last year if I remember correctly, but would have to search for it), a slight modification of the tax value (say 5.9999% but display only 6%), or an expansion on the data stored to include one additional decimal place, to name a few. I think I've seen a few others, but usually it is dependent on what is being seen and the specific product price. There are a few specific prices/tax rates that result in such "loss" of a penny...
We have this problem only with products that use SBA.
The price in orders_products gets rounded to 2 decimals somehow, where the pricein orders_products_attributs is shown correctly
see icture, top is orders_products, below orders_products_attributes
Attachment 17999