-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
mc12345678
@madshaun1984, et al...
Ok, figured out what's going on.
There were two things, one was the additional encoding that caused £ to become $amp;pound; in the txtXXX section (should be addressed by the above change(s) though processing of the code may make that change unnecessary), the other is/was that when selecting a "parent" option, the child select options are added by pushing the content to the option list. This push (creating a new option) though populated the text of the option not the html of the option. I.e put £ directly in the output text instead of the more "inner" html. So, while this was tested for the change identified at line 1053 below it has not been tested in absence of the previously posed changes or other similar changes that I made on my test server. I do think the below changes would address the wrongful display of £ instead of £.
I'm providing line numbers here working from the "bottom" to the "top" so that as each change is made the identified line numbers will still line up with the content on github at the moment (haven't pushed an update, just realized what needed to be done and proved that at least adding the change to line 1053 worked, though had also made some other changes as well that need to be validated as unnecessary.)
Between lines 1091 and 1092 having this content:
Code:
$out.='), opt.substring(1));' . "\n";
if ((STOCK_ALLOW_CHECKOUT == 'false' && ($curattr == count($attributes) - 2)) || PRODINFO_ATTRIBUTE_NO_ADD_OUT_OF_STOCK == 'True') {
Modify it to look like the below:
Code:
$out.='), opt.substring(1));' . "\n";
$out.=' frm["id[' . $attributes[$nextattr]['oid'] . ']"].options[frm["id[' . $attributes[$nextattr]['oid'] . ']"].length - 1].innerHTML = frm["id[' . $attributes[$nextattr]['oid'] . ']"].options[frm["id[' . $attributes[$nextattr]['oid'] . ']"].length - 1].text;' . "\n";
if ((STOCK_ALLOW_CHECKOUT == 'false' && ($curattr == count($attributes) - 2)) || PRODINFO_ATTRIBUTE_NO_ADD_OUT_OF_STOCK == 'True') {
and then again between lines 1066 and 1067 having this content:
Code:
$out.='), opt.substring(1));' . "\n";
if ((STOCK_ALLOW_CHECKOUT == 'false' && ($curattr == count($attributes) - 2)) || PRODINFO_ATTRIBUTE_NO_ADD_OUT_OF_STOCK == 'True') {
Modify it to look like:
Code:
$out.='), opt.substring(1));' . "\n";
$out.=' frm["id[' . $attributes[$nextattr]['oid'] . ']"].options[frm["id[' . $attributes[$nextattr]['oid'] . ']"].length - 1].innerHTML = frm["id[' . $attributes[$nextattr]['oid'] . ']"].options[frm["id[' . $attributes[$nextattr]['oid'] . ']"].length - 1].text;' . "\n";
if ((STOCK_ALLOW_CHECKOUT == 'false' && ($curattr == count($attributes) - 2)) || PRODINFO_ATTRIBUTE_NO_ADD_OUT_OF_STOCK == 'True') {
Between Lines 1052 and 1053 having this content:
Code:
$out.=', opt.substring(1));' . "\n";
$out.=' }';
have it look like the following:
Code:
$out.=', opt.substring(1));' . "\n";
$out.=' frm["id[' . $attributes[$nextattr]['oid'] . ']"].options[frm["id[' . $attributes[$nextattr]['oid'] . ']"].length - 1].innerHTML = frm["id[' . $attributes[$nextattr]['oid'] . ']"].options[frm["id[' . $attributes[$nextattr]['oid'] . ']"].length - 1].text;' . "\n";
$out.=' }';
Apparently my initial testing with the above change(s) was with a product condition that was incorrect. The testing involved a product that had prices in the first attribute (drawn by a different process) and not with a product that had attributes with prices in the second or subsequent attributes (option names). After testing with such a product the following was identified that corrected the reported issue (basically the array key addressing the "length" of the array should have had a '- 1' (in blue) in it in all cases.) Therefore, the following is recommended (and identified as functional):
Between lines 1091 and 1092 having this content:
Code:
$out.='), opt.substring(1));' . "\n";
if ((STOCK_ALLOW_CHECKOUT == 'false' && ($curattr == count($attributes) - 2)) || PRODINFO_ATTRIBUTE_NO_ADD_OUT_OF_STOCK == 'True') {
Modify it to look like the below:
Code:
$out.='), opt.substring(1));' . "\n";
$out.=' frm["id[' . $attributes[$nextattr]['oid'] . ']"].options[frm["id[' . $attributes[$nextattr]['oid'] . ']"].length - 1].innerHTML = frm["id[' . $attributes[$nextattr]['oid'] . ']"].options[frm["id[' . $attributes[$nextattr]['oid'] . ']"].length - 1].text;' . "\n";
if ((STOCK_ALLOW_CHECKOUT == 'false' && ($curattr == count($attributes) - 2)) || PRODINFO_ATTRIBUTE_NO_ADD_OUT_OF_STOCK == 'True') {
and then again between lines 1066 and 1067 having this content:
Code:
$out.='), opt.substring(1));' . "\n";
if ((STOCK_ALLOW_CHECKOUT == 'false' && ($curattr == count($attributes) - 2)) || PRODINFO_ATTRIBUTE_NO_ADD_OUT_OF_STOCK == 'True') {
Modify it to look like:
Code:
$out.='), opt.substring(1));' . "\n";
$out.=' frm["id[' . $attributes[$nextattr]['oid'] . ']"].options[frm["id[' . $attributes[$nextattr]['oid'] . ']"].length - 1].innerHTML = frm["id[' . $attributes[$nextattr]['oid'] . ']"].options[frm["id[' . $attributes[$nextattr]['oid'] . ']"].length - 1].text;' . "\n";
if ((STOCK_ALLOW_CHECKOUT == 'false' && ($curattr == count($attributes) - 2)) || PRODINFO_ATTRIBUTE_NO_ADD_OUT_OF_STOCK == 'True') {
Between Lines 1052 and 1053 having this content:
Code:
$out.=', opt.substring(1));' . "\n";
$out.=' }';
have it look like the following:
Code:
$out.=', opt.substring(1));' . "\n";
$out.=' frm["id[' . $attributes[$nextattr]['oid'] . ']"].options[frm["id[' . $attributes[$nextattr]['oid'] . ']"].length - 1].innerHTML = frm["id[' . $attributes[$nextattr]['oid'] . ']"].options[frm["id[' . $attributes[$nextattr]['oid'] . ']"].length - 1].text;' . "\n";
$out.=' }';
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
mc12345678
Apparently my initial testing with the above change(s) was with a product condition that was incorrect. The testing involved a product that had prices in the first attribute (drawn by a different process) and not with a product that had attributes with prices in the second or subsequent attributes (option names). After testing with such a product the following was identified that corrected the reported issue (basically the array key addressing the "length" of the array should have had a
'- 1' (in blue) in it in all cases.) Therefore, the following is recommended (and identified as functional):
Between lines 1091 and 1092 having this content:
Code:
$out.='), opt.substring(1));' . "\n";
if ((STOCK_ALLOW_CHECKOUT == 'false' && ($curattr == count($attributes) - 2)) || PRODINFO_ATTRIBUTE_NO_ADD_OUT_OF_STOCK == 'True') {
Modify it to look like the below:
Code:
$out.='), opt.substring(1));' . "\n";
$out.=' frm["id[' . $attributes[$nextattr]['oid'] . ']"].options[frm["id[' . $attributes[$nextattr]['oid'] . ']"].length - 1].innerHTML = frm["id[' . $attributes[$nextattr]['oid'] . ']"].options[frm["id[' . $attributes[$nextattr]['oid'] . ']"].length - 1].text;' . "\n";
if ((STOCK_ALLOW_CHECKOUT == 'false' && ($curattr == count($attributes) - 2)) || PRODINFO_ATTRIBUTE_NO_ADD_OUT_OF_STOCK == 'True') {
and then again between lines 1066 and 1067 having this content:
Code:
$out.='), opt.substring(1));' . "\n";
if ((STOCK_ALLOW_CHECKOUT == 'false' && ($curattr == count($attributes) - 2)) || PRODINFO_ATTRIBUTE_NO_ADD_OUT_OF_STOCK == 'True') {
Modify it to look like:
Code:
$out.='), opt.substring(1));' . "\n";
$out.=' frm["id[' . $attributes[$nextattr]['oid'] . ']"].options[frm["id[' . $attributes[$nextattr]['oid'] . ']"].length - 1].innerHTML = frm["id[' . $attributes[$nextattr]['oid'] . ']"].options[frm["id[' . $attributes[$nextattr]['oid'] . ']"].length - 1].text;' . "\n";
if ((STOCK_ALLOW_CHECKOUT == 'false' && ($curattr == count($attributes) - 2)) || PRODINFO_ATTRIBUTE_NO_ADD_OUT_OF_STOCK == 'True') {
Between Lines 1052 and 1053 having this content:
Code:
$out.=', opt.substring(1));' . "\n";
$out.=' }';
have it look like the following:
Code:
$out.=', opt.substring(1));' . "\n";
$out.=' frm["id[' . $attributes[$nextattr]['oid'] . ']"].options[frm["id[' . $attributes[$nextattr]['oid'] . ']"].length - 1].innerHTML = frm["id[' . $attributes[$nextattr]['oid'] . ']"].options[frm["id[' . $attributes[$nextattr]['oid'] . ']"].length - 1].text;' . "\n";
$out.=' }';
The lines didn't quite match up in the file on my server with those you specified, but once the lines had been found and edited, the drop down started working as expected immediately.
I haven't seen any debug logs generated since, so hopefully that will be that!
Thanks for the support on this! Much appreciated :)
-
1 Attachment(s)
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Test site for 1.5.5f on Linux
I have latest SBA Combined from Github and Edit Orders installed. Stock seems to work fine unless I use Edit Orders to change a quantity of any item. The attributes disappear from the entire order in any further view of the order. The attributes disappear also from the invoice and the packing slip. I have a screen shot I will try and attach. Attachment 17726
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
What version of Edit Orders is being used?
Was product that was edited one tracked by SBA?
What of the other product were tracked by SBA?
When the feature was added such changes in quantity were tested for both SBA product as well as not and combinations including product being first in the list, middle and last, increase and decrease of product quantity.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
mc12345678
What version of Edit Orders is being used?
Was product that was edited one tracked by SBA?
What of the other product were tracked by SBA?
When the feature was added such changes in quantity were tested for both SBA product as well as not and combinations including product being first in the list, middle and last, increase and decrease of product quantity.
The vesion: Edit Orders v4.x for Zen Cart 1.5.x
I just went into edit an order with Edit Orders with several products, some with attributes and some without, and changed the color only of one product in the middle of the list. Pushed the update button and all attributes for all products in the order disappeared.
However: when I then, edit the same order with Edit Orders, to add an item with attributes it works and the item with attribute for that item shows up in the order and the math is corrected in the order total. If you can help me get this site up... been working on it too long now... I would employ you to do so. PM me.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
SBA is tracking the stock. It will not let me add things that are out of stock through EditOrders. It does let me know that items were not updated because their attributes do not exist... since those attributes were eliminated in the previous test update; but it keeps the item in the order even though there is no attribute specified as required in the normal ordering process.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
athena
SBA is tracking the stock. It will not let me add things that are out of stock through EditOrders. It does let me know that items were not updated because their attributes do not exist... since those attributes were eliminated in the previous test update; but it keeps the item in the order even though there is no attribute specified as required in the normal ordering process.
Want to confirm. The product identified above that is shown as three different line items, that is a product tracked by SBA?
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
@athena, looks to me like there has been a change to edit orders that has caused this issue... Disabling the SBA portion of the code, a product/screen that is updated by selecting the update button has the attributes stripped from it... Still trying to work through that issue regardless.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
mc12345678
@athena, looks to me like there has been a change to edit orders that has caused this issue... Disabling the SBA portion of the code, a product/screen that is updated by selecting the update button has the attributes stripped from it... Still trying to work through that issue regardless.
Forgot to mention how to "disable the SBA portion". Renaming the file admin/includes/auto_loaders/config.eo_sba.php to have an extension other than .php ie: config.eo_sba.php.txt will prevent it from loading, without it loading, then the code related to SBA does not run when using edit orders. At least on the configuration I was running I had the same issue as described above where attributes of an existing product were stripped when selecting the update button from the edit orders screen. I didn't try modifying one of the attributes even or the quantity, just simply pressing the update button was enough to cause the issue.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
The above issue has been confirmed as being a result of a minor bug in Edit Orders version 4.3.1 and is to be corrected in the next release. The fix is posted here in the edit orders thread.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Thank you. Nice to know after years of working with SBA it is not the issue here. I can work on that edit to the edit-orders code myself but sent you some log in by pm so don't know if you are actively looking at it. Let's stay in touch. I had been over to the Edit-orders but worried I'd get chased off because it has always been an SBA issue for our cart over the years. ;)
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
155f install... live site.
I'm finding on admin/product.php or on my product pages in the admin that I am not seeing any reference to attributes for items with attributes. Previous to our upgrade from a very hacked version of SBA we did have a button on the product page, next to the quantity in stock, to take us to the attribute edit page for that item. There is a lot of code referring to attributes on the product.php page but I am not seeing the application for it. What does it do? Here is the SBA code edit but it does not seem to be related to the link to the product attribute edit page or do anything I can see on the admin/product.php page. Using Stock_By_Attributes_Combined-master folder for 1_5_6
Code:
// BOF Added for Stock By Attributes SBA
$zco_notifier->notify('NOTIFY_ADMIN_PRODUCT_COPY_TO_ATTRIBUTES', $contents, $contents);
// EOF Added for Stock By Attributes SBA
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
athena
155f install... live site.
I'm finding on admin/product.php or on my product pages in the admin that I am not seeing any reference to attributes for items with attributes. Previous to our upgrade from a very hacked version of SBA we did have a button on the product page, next to the quantity in stock, to take us to the attribute edit page for that item. There is a lot of code referring to attributes on the product.php page but I am not seeing the application for it. What does it do? Here is the SBA code edit but it does not seem to be related to the link to the product attribute edit page or do anything I can see on the admin/product.php page. Using Stock_By_Attributes_Combined-master folder for 1_5_6
Code:
// BOF Added for Stock By Attributes SBA
$zco_notifier->notify('NOTIFY_ADMIN_PRODUCT_COPY_TO_ATTRIBUTES', $contents, $contents);
// EOF Added for Stock By Attributes SBA
As noted, the link that was previously seen was from modifications of some sort that had been applied to provide such a Stock By Attributes link from the product page. (I think that I have seen such a link offered through one of Numinix' additional fields related modules.)
The current implementation does not attempt to add such a link into that screen as perhaps the best user experience is to either offer the information in the current screen or to open a separate window (new tab, new browser, etc...) so as not to lose information already entered. However, in following the ZC suggestions of accessing the admin, only one window to the admin should be open at any one time. Adding a link directly on the product page that is always active (ie. not disabled once some change had been applied to the page and not yet saved) has not been a consideration within the current implementation. There are changes afoot, I believe thanks to Design75, that will place all such content in tabs and allow a larger amount of product information to be edited in a single location rather than bouncing around. To further take advantage of that "feature" whatever coding SBA would need would be incorporated into the SBA distribution to support that. In the mean time, when viewing the products/categories listing, the SBA entry for a specific product can be found by a total of two bounces (requiring three clicks) by selecting the attributes icon, then selecting attributes controller (on the right) then selecting Stock By Attributes at the top of the screen which will open the SBA entry screen with the product selected for editing.
Regarding the notifier identified above which has been added in the respective product.php file for all supported versions, that notifier is included to support copying SBA attributes when copying a product (as a unique new item) tracked by SBA similar to copying the attributes of one product. Note that the ZC code contained in the 1.5.6 files may not be up-to-date with the current alpha/beta distribution of ZC 1.5.6, but were identified as functional at the time of incorporation. As development of ZC 1.5.6 continues, the SBA files are periodically updated to match.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Just thanking all who have worked on this. We can not upgrade without SBA: From Tom who uses it most: "There are three things I like about the New Stock By Attributes:
The list is sorted by model number, rather than product name. This helps as we update inventory. We use the model number to find items in the admin.
The list is searchable by model number. This helps us because we have so many items that are stocked by attributes.
We used to use a link to Stock By Attributes from the individual product admin page to go quickly to the attributes for a product. While this feature is now gone, the two features above make up for that. It would be nice to reestablish that link or make a tiny statement or icon next to the Products Quantity to help us know if the product has attributes or not. That “A” Icon is displayed on an admin product page that shows all the products in a category or in a search of the admin.
And there is now a link to Stock By Attributes from the Attributes Controller page. At least I think that is a new feature. That can come in handy when working with the option names and values and then jump right to Stock By Attributes to finish the product info."
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
athena
Just thanking all who have worked on this. We can not upgrade without SBA: From Tom who uses it most: "There are three things I like about the New Stock By Attributes:
The list is sorted by model number, rather than product name. This helps as we update inventory. We use the model number to find items in the admin.
The list is searchable by model number. This helps us because we have so many items that are stocked by attributes.
We used to use a link to Stock By Attributes from the individual product admin page to go quickly to the attributes for a product. While this feature is now gone, the two features above make up for that. It would be nice to reestablish that link or make a tiny statement or icon next to the Products Quantity to help us know if the product has attributes or not. That “A” Icon is displayed on an admin product page that shows all the products in a category or in a search of the admin.
And there is now a link to Stock By Attributes from the Attributes Controller page. At least I think that is a new feature. That can come in handy when working with the option names and values and then jump right to Stock By Attributes to finish the product info."
Code that could be used to present a link/image based on data collected by SBA:
Does the product have attributes:
Code:
if (!empty((int)$_GET['pID']) && $products_with_attributes_stock_class->get_products_attributes((int)$_GET['pID']) !== false) {
// Display icon/link for managing attributes of some type.
// Link for Attributes Controller: zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . (int)$_GET['pID'] . '¤t_category_id=' . $current_category_id));
// To determine if link should be associated with SBA:
if ($_SESSION['pwas_class2']->zen_product_is_sba((int)$_GET['pID'])) {
// Display icon/link for managing SBA attributes.
// Link: zen_href_link(FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK, 'seachPID=' . (int)$_GET['pID']);
}
}
Where (int)$_GET['pID'] could be substituted with $pInfo->products_id depending where in the file this call is made and $current_category_id for use with the attributes controller is the category id associated with the product/current category in which the product is being edited.
From within the admin screen for filling in the product information (typically admin/includes/modules/PRODUCT_TYPE/collect_info.php), these variables are (int)$_GET['pID'] or $pInfo->products_id and (int)$current_category_id or $cInfo->categories_id, respectively. Though, until a product is stored, the only potentially useful data is the category related information. What this means is that a new product should not already have information in either the attributes controller nor in SBA (assuming database integrity for both tables) and that in the absence of either/both of those pieces of information that there would not be data available to identify the need for a link to either of those two locations for the current product.
Also note that currently once on the SBA product information screen, the product edit option is available to return to the product itself (selecting this option without first saving changes made to the onscreen data will result in loss of those changes). An option has not (yet) been added to go directly to the attributes controller from the SBA product information screen.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
ZC 1.5.5d (live site in signature)
SBA 1.5.4
It's been working fine, but if you change the 'Quantity' of an attribute in admin, the "Quantity for all variants" does not update to reflect the total number of items. A "Sync Quantities" fixes this, but why does this not happen automatically?
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
ttfan
ZC 1.5.5d (live site in signature)
SBA 1.5.4
It's been working fine, but if you change the 'Quantity' of an attribute in admin, the "Quantity for all variants" does not update to reflect the total number of items. A "Sync Quantities" fixes this, but why does this not happen automatically?
For some it is a feature, for others it can be a bug. A "clean" handling mechanism hasn't been developed, but there is this to consider and one of the things about continued development of this plugin.
There is no requirement that the sum of the individual variants must equal the sum of all possible products.
For example, a "product" could be made of a combination of individual attributes instead of a combination of attributes, take for example a product sold that has a size and a color of say a patch applied to it. There could be three sizes for example and a single patch quantity. When purchasing you can either add the patch or not. If there are 5 shirts of each of the three sizes and there happen to be only 8 patches. Should the total of the items be 23? Or really should it be15? What about for those that sell the item only if all options are available and therefore only 8?
Currently only variations that are fully defined by combination of attributes or those not having any combinations but instead all individual are best supported. There isn't yet a process incorporated to cleanly handle both on a single product.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
mc12345678
For some it is a feature, for others it can be a bug. A "clean" handling mechanism hasn't been developed, but there is this to consider and one of the things about continued development of this plugin.
There is no requirement that the sum of the individual variants must equal the sum of all possible products.
For example, a "product" could be made of a combination of individual attributes instead of a combination of attributes, take for example a product sold that has a size and a color of say a patch applied to it. There could be three sizes for example and a single patch quantity. When purchasing you can either add the patch or not. If there are 5 shirts of each of the three sizes and there happen to be only 8 patches. Should the total of the items be 23? Or really should it be15? What about for those that sell the item only if all options are available and therefore only 8?
Currently only variations that are fully defined by combination of attributes or those not having any combinations but instead all individual are best supported. There isn't yet a process incorporated to cleanly handle both on a single product.
Another way this can be used for store owners (until yet another feature is specifically added) is that the total quantity of product can be larger than the sum of the available variants so that the product can remain visible even when all of the current variants are sold out.
By having a quantity of product still available, a store set to disable product when the quantity is goes to zero (ie. Can not oversell product) will still show the product. The display of "normally" available attributes is controlled by other settings but could potentially display all possible variants with all being out-of-stock for those that wish to be able to show potential variants.
On the flip side, a product could be made to go out-of-stock after x product have been sold regardless the individual variant availability by only identifying the x quantity of product. Then after selling that many product it goes out-of-stock...
I'm aware that it would be helpful to also have the click to edit option on the admin screen and I believe there is sufficient code available to incorporate it, but I haven't yet.
At the moment I'm trying to incorporate some other development code to address strict php processing and some other minor user improvements/features that have been developed. Quite literally have been doing that today among other things with other software.
I'm sure I can think of other ways that the total quantity as compared to the individual variant quantity can be used to accomplish a goal. For now I've been trying to not to unnecessarily limit the capability even if it may require a little extra effort/thought for those just wanting basic stock control of attribute related product.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
That makes perfect sense, thank you mc12345678!
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
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.
-
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
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
Marc Boon
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
For your system, can you show data for a product that is setup with similar price-by-attributes conditions but is not assigned to SBA as a comparison? Please include both the data of the page information (whether it shows 24.99 or 25.00) and the purchase result data as provided above.
When the product is not tracked by SBA, then the built in ZC calculations and processing are used. If there is a difference in display of the two product (tracked with SBA and not) at the product page display, then please identify the number of attributes assigned to the product and the configuration settings for Dynamic Dropdowns. This last piece of information is to understand the setup and either provide guidance on a change or correct the code, it is not to suggest (yet) changing those settings.
-
1 Attachment(s)
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Attachment 18001To partially answer the above question, from my mobile device I setup a product that was not tracked by SBA on a ZC 1.5.5f system that has Dynamic Price Updater installed (note that DPU uses the shopping cart class to identify the price which is displayed at the upper portion of the screen). Added a tax class and associated settings for a 6% sales tax, display the price on the store front with tax included, and added a product priced by attributes with a single attribute having the price of 23.5849.
The result (seen in the attached image) is that the product price is shown as 24.99, but the attribute's price shows as 25.00 which is the same values reported in the previous posting.
Conclusion? SBA does not cause the displayed price difference. Unfortunately it also doesn't "fix" it either (yet). As said before there are some calculation differences that have been identified in the software that show themselves in different areas. For the most part it is a result of the multiple ways that calculations are performed, carrying of significant figures and various independent and integrated methods of calculations. For those that remember their math days, generally speaking the system of equations is overdetermined causing there to be insufficient degrees of freedom to find the one solution to each of the sought after number values. Ie. In one case looking for the exact value of the tax and at the same time the overall price to pay or in the case of VAT the price of each product before taxes and after taxes as well as the tax itself. There is likely to exist one or more occurrences where quantity, price, and tax will not all "add" up. This is pretty much regardless the software system being used. There are ways to prevent such issues from generally being seen, but...
I'll give a quick example. Went to somewhere where a product was 0.40 and had I think 11% sales tax... buy one item and the cost is 0.44 (0.444)... but buy 2 and the total cost is 0.89 (0.888 which is effectively 0.444 each or after purchase is 0.445 each)... as a consumer, buy two but one at a time and save money, right??? But I go so far as to ask how is that "penny" handled? Who gets it? Who has to "pay" extra? (ie. Those single purchases add up over time and if one were to count the number of single purchases, add up the sale price and then try to determine the amount of tax to have been collected, the store comes out short... but if many buy 2 at a time, the reverse is true isn't it? The store comes out ahead... but if the quantity of single item purchases and the tax collected for each of those is added together and the same done with the 2 item purchases, then the books balance from that perspective if ignore the total money collected for the product and the total tax collected... it's an accountant's issue in my mind, but...)
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
mc12345678
For your system, can you show data for a product that is setup with similar price-by-attributes conditions but is not assigned to SBA as a comparison? Please include both the data of the page information (whether it shows 24.99 or 25.00) and the purchase result data as provided above.
When the product is not tracked by SBA, then the built in ZC calculations and processing are used. If there is a difference in display of the two product (tracked with SBA and not) at the product page display, then please identify the number of attributes assigned to the product and the configuration settings for Dynamic Dropdowns. This last piece of information is to understand the setup and either provide guidance on a change or correct the code, it is not to suggest (yet) changing those settings.
We are using the ZEN cart to sell tickets for our steamtrain.
there are multiple products that sufferfrom this problem.
when i look in orders_porducts table i see all SBA related prices at 2 decimals rounded
the products that are affecte have two options,
the customer has to select a date and a type of card ( children, adults etc )
prices for products without SBA get noted in orders_products with all 4 decimals
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
Marc Boon
We are using the ZEN cart to sell tickets for our steamtrain.
there are multiple products that sufferfrom this problem.
when i look in orders_porducts table i see all SBA related prices at 2 decimals rounded
the products that are affecte have two options,
the customer has to select a date and a type of card ( children, adults etc )
prices for products without SBA get noted in orders_products with all 4 decimals
-so that last remark points to SBA imho...
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
Marc Boon
We are using the ZEN cart to sell tickets for our steamtrain.
there are multiple products that sufferfrom this problem.
when i look in orders_porducts table i see all SBA related prices at 2 decimals rounded
the products that are affecte have two options,
the customer has to select a date and a type of card ( children, adults etc )
prices for products without SBA get noted in orders_products with all 4 decimals
Do these product (SBA/not SBA) have the same prices? Need to be sure that we are comparing same numerical values.
Also to be sure, the only issue of difference being discussed or of concern between how the standard ZC works and how it appears that SBA is working is the storage of the orders_products data, correct?
-
2 Attachment(s)
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
mc12345678
Do these product (SBA/not SBA) have the same prices? Need to be sure that we are comparing same numerical values.
Also to be sure, the only issue of difference being discussed or of concern between how the standard ZC works and how it appears that SBA is working is the storage of the orders_products data, correct?
here is the product with the SBA
Attachment 18002
here a test-product without the SBA
Attachment 18003
both have the same bruto pricing, but different results as seen
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
I realize that you have a problem that you want fixed and while SBA doesn't currently fix the problem, contrary to the original post about the problem, SBA doesn't cause it and truly is unrelated to it. I am able to say this from independently performing the following tests:
It appears that I didn't give good direction on how to setup a product that has all of the same characteristics as the original reported, but is not Stocked by Attributes. So, I did this, but it also means that you should still do this to prove to yourself what I am saying.
Starting with a ZC 1.5.5f system. I went into configuration->my store and set the display price with tax for store and admin to true. I then created a tax rate and associated zoning to be able to apply a 6% tax rate to product. I then created a product that is enabled, priced-by-attributes, has a 0 price, has the tax rate just created, and has a quantity of 100.
I then went through the save process.
I went into the attributes controller for that product and added a single attribute of option name size and option value of small. I set all buttons on the attribute except for display only and required. I added a price to the attribute of 23.5849.
I saved the attribute.
I verified that I had the shipping option of in store enabled and the payment of check/money order enabled. Neither of these adds a price to the overall operation working like a digital product (for shipping).
On the store side, I now went through the purchase process for the product. The product page showed a product price of 24.99, the attribute showed 25.00. Going through checkout, using pickup in store and check/money order, the shopping cart showed 24.99 all the way through to checkout success with tax being 1.41. After checkout, looking at the orders_product for the order, it was shown as 23.5800, the orders table reflected a total price of 24.9948 and the orders_products_attributes shows 23.5849. This is before SBA was even installed. Which means that SBA as I said, does not cause the pricing problem that you are seeing... it is something that exists already in the ZC software.
Further, when I attempted to create a product that didn't have attributes (and therefore wasn't priced-by-attributes and also not controlled by SBA) that had a "final" (gross) price of 25.00, it had a net price of 23.5849. On every page except for the confirmation page the price showed as 25.00. On the confirmation page the price showed as 24.99...
The rounding is occurring in includes/classes/order.php within the function cart() where the final_price is being set at:
Code:
'final_price' => zen_round($products[$i]['price'] + $_SESSION['cart']->attributes_price($products[$i]['id']), $decimals),
and where $decimals is set at the beginning of the function as:
Code:
$decimals = $currencies->get_decimal_places($_SESSION['currency']);
For the Netherlands this results in a 2 decimal quantity being set for the products final price. SBA doesn't modify either of these values. Then after the assignment of final_price to the product, the overall price to collect from the customer is "calculated" which in this case results in the loss of a "penny". Perhaps ZC should behave differently when the price of the product includes the taxes (such that the ORDER_PRODUCTS table is populated with the four decimal value instead of rounding to the current currency).
Anyways, most of the above really should be addressed outside of this forum and I recommend that you continue to seek resolution and perhaps a global solution for all conditions, but outside of the Stock By Attributes forum.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
error in logs
zc 1.5.5f, classic responsive clone, php 7.1.1
Found this error from a few days back in my log folder:
HTML Code:
[01-Jun-2018 08:30:38 America/Chicago] PHP Warning: Invalid argument supplied for foreach() in root/includes/classes/class.products_with_attributes_class_stock.php on line 1285
[01-Jun-2018 08:30:38 America/Chicago] Request URI: /index.php?main_page=product_info&cPath=26&products_id=500&number_of_uploads=0&action=add_product, IP address: 209.5.238.12
#1 products_with_attributes_class_stock->zen_get_sba_attribute_info() called at [root/includes/extra_cart_actions/stock_by_attributes.php:883]
#2 include(root/includes/extra_cart_actions/stock_by_attributes.php) called at [root/includes/main_cart_actions.php:26]
#3 require(root/includes/main_cart_actions.php) called at [root/includes/init_includes/init_cart_handler.php:44]
#4 require(root/includes/init_includes/init_cart_handler.php) called at [root/includes/autoload_func.php:48]
#5 require(root/includes/autoload_func.php) called at [root/includes/application_top.php:170]
#6 require(root/includes/application_top.php) called at [root/index.php:26]
Checking on site - I am able to add product (has one attribute variable only - size) to cart without throwing error. The product cateogy 26 is Qiviut Socks on site in my sig.
Thx
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
soxophoneplayer
error in logs
zc 1.5.5f, classic responsive clone, php 7.1.1
Found this error from a few days back in my log folder:
HTML Code:
[01-Jun-2018 08:30:38 America/Chicago] PHP Warning: Invalid argument supplied for foreach() in root/includes/classes/class.products_with_attributes_class_stock.php on line 1285
[01-Jun-2018 08:30:38 America/Chicago] Request URI: /index.php?main_page=product_info&cPath=26&products_id=500&number_of_uploads=0&action=add_product, IP address: 209.5.238.12
#1 products_with_attributes_class_stock->zen_get_sba_attribute_info() called at [root/includes/extra_cart_actions/stock_by_attributes.php:883]
#2 include(root/includes/extra_cart_actions/stock_by_attributes.php) called at [root/includes/main_cart_actions.php:26]
#3 require(root/includes/main_cart_actions.php) called at [root/includes/init_includes/init_cart_handler.php:44]
#4 require(root/includes/init_includes/init_cart_handler.php) called at [root/includes/autoload_func.php:48]
#5 require(root/includes/autoload_func.php) called at [root/includes/application_top.php:170]
#6 require(root/includes/application_top.php) called at [root/index.php:26]
Checking on site - I am able to add product (has one attribute variable only - size) to cart without throwing error. The product cateogy 26 is Qiviut Socks on site in my sig.
Thx
I was able to reproduce this error locally if a product with attributes, that is tracked by SBA and has radio attributes was attempted to be added to the cart but without any selections made. (Was able to use the browser editor to remove selected="selected" from the option value... The error was generated and the product was added to the cart without any attributes present. Will look into it though on preventing the processing/issue.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
mc12345678
I was able to reproduce this error locally if a product with attributes, that is tracked by SBA and has radio attributes was attempted to be added to the cart but without any selections made. (Was able to use the browser editor to remove selected="selected" from the option value... The error was generated and the product was added to the cart without any attributes present. Will look into it though on preventing the processing/issue.
Thank you.
I use the radio button for size select and I have one size set as default, along with default quantity of 1. I guess some one must have back-spaced the quantity out but not selected (or wearing tri-focals like me and thought they hit the selection button but missed) and then hit add to cart. Orders have gone through fine on this product so the error threw up an 'oh no somethings gone wrong' moment for me. Thanks again for looking at this.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
hello, i am using zc 1.51 and installed this module, i have found that i cant add the attibute to the cart, always says empty cart. what file handles this action? i may have not merged properly?
Jimmie
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
jimmie
hello, i am using zc 1.51 and installed this module, i have found that i cant add the attibute to the cart, always says empty cart. what file handles this action? i may have not merged properly?
Jimmie
From where did you obtain the module, when installing was merging used where appropriate or files just replaced?
The current install of this module has an includes/extra_cart_actions file that processes the submission if the item is tracked by SBA to ensure it is added to the cart if the quantities work out.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
downloaded from this site (stock_by_attribute_1.5.3), merged with notepad++, Compare plugin
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
jimmie
For product that are identified as having quantity remaining it appears that they are added to the cart, for product that are currently out-of-stock, it looks like you have setup the site to support special ordering or the ability to back order.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
yes i allow back orders, or drop ship from company, same product from my mainsite, https://jnsflooringandsupplies.com/i...oducts_id=8202 and works as it should, module not installed yet.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
So I'm not sure what the issue is at the moment. The one on the Worksite seems to be functional, the main site does not appear to have this module installed. On top of all that, there is a slightly more updated version of the plugin that still works with ZC 1.5.1 found at https://github.com/mc12345678/Stock_...butes_Combined
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
ill try that 1, it looks as if my ajax cart not excepting the product, when i add product and wait for cart pop up to disapear it shows a product,
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
same thing with new module installed
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
jimmie
ill try that 1, it looks as if my ajax cart not excepting the product, when i add product and wait for cart pop up to disapear it shows a product,
When I had previously tried to add a product to the Worksite it seemed like the product was added via the ajax method. When I went to the shopping cart it was there. If the product was originally identified as in stock, then it showed as an appropriate quantity, if it was shown as special order or out-of-stock, then the cart showed a special order condition.
Right now I am getting a 500 error on the test site and mixed content on your live site.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
starting over on worksite, uploading backup
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
ok i have have only uploaded the core files(Not the Files from 1_5_1 except 1 header file) and it does now add it to cart, now i have to go through each modified file and merge 1 by 1
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
jimmie
ok i have have only uploaded the core files(Not the Files from 1_5_1 except 1 header file) and it does now add it to cart, now i have to go through each modified file and merge 1 by 1
Which header file was incorporated?
At moment am seeing that the first product added may be identified as special order where the second not and trying to see what is causing that.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
this file i added header_php_sba.php besides core file no other changes
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
why when sync products it adds quantity to all attributes with zero quantity
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
and is there a way to search by customid from search bar on main page or admin, i also use zencart as a pos in my store and look up by barcode, how can i add a barcode to attributes?
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
got to unmodify files back to original, now i cant log in.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
jimmie
why when sync products it adds quantity to all attributes with zero quantity
The sync quantity option is designed to make the total number of product associated with all of the variants equal the sum of the variant quantity. For some having the total number of product equal to the total number of variants is necessary to support operations. For others either it doesn't matter or it is important that the total product quantity is a number different than the sum of the variants.
It is not required that the quantity be synchronized.
That said and looking over the question again, I don't believe I fully understood the question or what is happening that is unexpected.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
jimmie
got to unmodify files back to original, now i cant log in.
Explain "can't login". Blank page? Doesn't accept userid and password? What? Error logs generated in your logs directory?
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
jimmie
and is there a way to search by customid from search bar on main page or admin, i also use zencart as a pos in my store and look up by barcode, how can i add a barcode to attributes?
There is, as seen in a few other threads, it tends to require modifying some of the core search files, which I haven't included in the plugin's standard fileset yet. The field in question is the customid generally speaking though in the checkout process it can become the model number if so desired.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
now works in different browser
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
sync option i thought totals up all attributes with stock adds that as total to qty, which i use to show customers green yellow red light depending on available stock, i put stock only on 1 attribute but gave all attributes the same after clicking sync
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
cant login in using firefox or chrome , just refreshes the page, i can with the e
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
im getting this error when i click confirm order
[10-Sep-2018 13:52:11 America/New_York] PHP Warning: strpos() expects parameter 1 to be string, array given in /var/www/clients/client1/web4/web/WorkSite/includes/classes/shipping.php on line 32
[10-Sep-2018 13:52:11 America/New_York] PHP Warning: substr() expects parameter 1 to be string, array given in /var/www/clients/client1/web4/web/WorkSite/includes/classes/shipping.php on line 32
[10-Sep-2018 13:52:11 America/New_York] PHP Warning: strpos() expects parameter 1 to be string, array given in /var/www/clients/client1/web4/web/WorkSite/includes/classes/order.php on line 390
[10-Sep-2018 13:52:11 America/New_York] PHP Warning: strpos() expects parameter 1 to be string, array given in /var/www/clients/client1/web4/web/WorkSite/includes/modules/order_total/ot_shipping.php on line 41
[10-Sep-2018 13:52:11 America/New_York] PHP Warning: substr() expects parameter 1 to be string, array given in /var/www/clients/client1/web4/web/WorkSite/includes/modules/order_total/ot_shipping.php on line 41
[10-Sep-2018 13:52:11 America/New_York] PHP Warning: strpos() expects parameter 1 to be string, array given in /var/www/clients/client1/web4/web/WorkSite/includes/classes/order.php on line 700
[10-Sep-2018 13:52:11 America/New_York] PHP Warning: addslashes() expects parameter 1 to be string, array given in /var/www/clients/client1/web4/web/WorkSite/includes/functions/functions_general.php on line 861
[10-Sep-2018 13:52:11 America/New_York] PHP Warning: explode() expects parameter 2 to be string, array given in /var/www/clients/client1/web4/web/WorkSite/includes/classes/observers/class.advshipperCheckoutProcess.php on line 48
[10-Sep-2018 13:52:11 America/New_York] PHP Warning: explode() expects parameter 2 to be string, array given in /var/www/clients/client1/web4/web/WorkSite/includes/classes/observers/class.sopshipperCheckoutProcess.php on line 48
[10-Sep-2018 13:52:11 America/New_York] PHP Fatal error: Call to a member function RecordCount() on a non-object in /var/www/clients/client1/web4/web/WorkSite/includes/classes/observers/class.products_with_attributes_stock.php on line 727
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
getting this error when try to look at orders
[10-Sep-2018 14:09:17 America/New_York] PHP Fatal error: Call to undefined method order::notify() in /var/www/clients/client1/web4/web/WorkSite/FAKEADMIN/includes/classes/order.php on line 184
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
jimmie
im getting this error when i click confirm order
[10-Sep-2018 13:52:11 America/New_York] PHP Warning: strpos() expects parameter 1 to be string, array given in /var/www/clients/client1/web4/web/WorkSite/includes/classes/shipping.php on line 32
[10-Sep-2018 13:52:11 America/New_York] PHP Warning: substr() expects parameter 1 to be string, array given in /var/www/clients/client1/web4/web/WorkSite/includes/classes/shipping.php on line 32
[10-Sep-2018 13:52:11 America/New_York] PHP Warning: strpos() expects parameter 1 to be string, array given in /var/www/clients/client1/web4/web/WorkSite/includes/classes/order.php on line 390
[10-Sep-2018 13:52:11 America/New_York] PHP Warning: strpos() expects parameter 1 to be string, array given in /var/www/clients/client1/web4/web/WorkSite/includes/modules/order_total/ot_shipping.php on line 41
[10-Sep-2018 13:52:11 America/New_York] PHP Warning: substr() expects parameter 1 to be string, array given in /var/www/clients/client1/web4/web/WorkSite/includes/modules/order_total/ot_shipping.php on line 41
[10-Sep-2018 13:52:11 America/New_York] PHP Warning: strpos() expects parameter 1 to be string, array given in /var/www/clients/client1/web4/web/WorkSite/includes/classes/order.php on line 700
[10-Sep-2018 13:52:11 America/New_York] PHP Warning: addslashes() expects parameter 1 to be string, array given in /var/www/clients/client1/web4/web/WorkSite/includes/functions/functions_general.php on line 861
[10-Sep-2018 13:52:11 America/New_York] PHP Warning: explode() expects parameter 2 to be string, array given in /var/www/clients/client1/web4/web/WorkSite/includes/classes/observers/class.advshipperCheckoutProcess.php on line 48
[10-Sep-2018 13:52:11 America/New_York] PHP Warning: explode() expects parameter 2 to be string, array given in /var/www/clients/client1/web4/web/WorkSite/includes/classes/observers/class.sopshipperCheckoutProcess.php on line 48
[10-Sep-2018 13:52:11 America/New_York] PHP Fatal error: Call to a member function RecordCount() on a non-object in /var/www/clients/client1/web4/web/WorkSite/includes/classes/observers/class.products_with_attributes_stock.php on line 727
SBA offers one and only one modification to the includes/modules/pages/checkout_confirmation/header_php.php file (which looks like the file that may be associated with this issue). The one change is to add
Code:
, $order->products[$i]['attributes'], 'order'
to the end of the line that starts with:
Code:
if ($stock_check[$i] = zen_check_stock($order->products[$i]['id'], $order->products[$i]['qty']
All of the issues identified above appear to be related to the header file and capturing information from the generated page. The first issue appears to be that the shipping method was stored to the page as an array which seems to cause many of the follow-on issues.
At any rate, SBA makes the one change identified above and adds changes in two places of the checkout_confirmation template to display some additional information (that information is not required to be on the page to support operation, but helps keep information together as relates to the customid information if desired to be shown.) Technically, if both files were restored to their original condition then SBA would work just fine except for the condition where the person arriving at this page may be permitted to purchase an item that has already run out of stock because a "previous" person purchased it just before the confirmation page was processed.
What I'm saying is, that while perhaps one of the files from the plugin was used to fully overwrite some existing template file, there really is little from the provided template file that needs to be modified, as such I can not say that there is a specific problem with the plugin, but perhaps a way that it was "introduced" into the store code. Typically should start at the top of the errors and work down, this means that the first issue seen is that line 32 of the shipping class should be receiving a string not an array. After that, pretty much everything else is a result of that issue.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
jimmie
getting this error when try to look at orders
[10-Sep-2018 14:09:17 America/New_York] PHP Fatal error: Call to undefined method order::notify() in /var/www/clients/client1/web4/web/WorkSite/FAKEADMIN/includes/classes/order.php on line 184
Didn't put a comment in the file, but in:
admin/includes/classes/order.php
Change:
to:
Code:
class order extends base {
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
i believe i now have it working
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
jimmie
i believe i now have it working
Good. What was the cause of all of the messages when clicking on the continue button for the checkout_confirmation page?
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
not really sure, restarted, there are some things i merged that i shouldnt have, this time i merged 1 file at a time, saved, checked site and it is working so im carrying on
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
what triggers swapping to attribute picture instead of product picture?
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
jimmie
what triggers swapping to attribute picture instead of product picture?
Well, you're using radio buttons which as I recall isn't in the design to automatically use, but could be added with a little work. If I'm wrong about that there is a setting added to the configuration->attributes section to be able to disable it.
If it is something desired, then changing the attribute option name type to the newly added SBA select (dropdown) option will activate that, but will also change your radio buttons to a dropdown.
Sorry, am busy with something and unable to navigate the code at the moment to further clarify.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
How can i hide Customid on product info page, my Customers dont really need to see this on this page?
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
for starters if i was to use developers tools to search for every instance of customid and copied and pasted in ProductUPC would that work to add a Product UPC?
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
jimmie
for starters if i was to use developers tools to search for every instance of customid and copied and pasted in ProductUPC would that work to add a Product UPC?
on trying it, not gonna work that way, i just need to "scan" for it using a barcode scanner. Doesnt need to show anywhere except admin. would also like to "search" by customid
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
jimmie
How can i hide Customid on product info page, my Customers dont really need to see this on this page?
So there is an admin setting in configure->Stock that opts to display or not display the customid. The customid is whatever data you put into the field, though currently it is set/considered to be a string of some type. The constant associated with this option is: STOCK_SBA_DISPLAY_CUSTOMID.
There are a few places associated with the catalog side where this is used/listed:
includes/classes/observers/class.products_with_attributes_stock.php (2 places, one for the attributes list and one for the customer account history)
includes/templates/YOUR_TEMPLATE/templates/tpl_shopping_cart_default.php (for the shopping cart)
Currently if you want to keep it on for the admin but turn it off for the catalog, then I might suggest (though haven't tried) to modify the code in that area to be something like:
Code:
false && STOCK_SBA_DISPLAY_CUSTOMID == 'true'
As for searching on the information, I recently saw some incorporated code that would make the customid a part of the search which I was going to incorporate, but hadn't yet. The field just needs to be added in as part of the overall search criteria.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
this product i use grid on, https://jnsflooringandsupplies.com/i...oducts_id=8205
it has the word Quantity in a weird place, how to remove that and highlite option_name make it look the same as sba basic, or radio ETC.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
jimmie
While this question is better suited in the Products Attribute Grid forum, the answer to the first part is to modify includes\languages\english\extra_definitions\absolute_attribute_grid.php and change:
Code:
define('TEXT_ATTRIBUTE_GRID_QTY', 'Quantity' );
to:
Code:
define('TEXT_ATTRIBUTE_GRID_QTY', '' );
The second part, could add to the stylesheet.css file somewhere after line one:
Code:
#attrib-grid-opt-nameV {
font-weight: 600;
}
Or adjust as necessary.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
the dynamic drop down allows checkout when nothing is picked, how do i make it read only, (Please check from below)
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
jimmie
the dynamic drop down allows checkout when nothing is picked, how do i make it read only, (Please check from below)
Do you have one or more than one option name associated with the product in question?
If one, then suggest going to admin->catalog->option Name Manager, selecting the option name in question, edit, and change the option Type from most likely Dropdown to: SBA Select List (Dropdown) Basic.
If more than one option name then will need more information.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
https://jnsflooringandsupplies.com/i...4ecc507614cc5c. i have set all option names to this SBA Select List (Dropdown) Basic, went to dynamic dropdowns set that to sba sequenced dropdowns, but can still check out
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
and this never changes, The combination of options you have selected is currently out of stock. Please select another combination. i reworded it to this for now, Please select the applicable Color before adding to the cart.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
jimmie
Under configuration->dynamic drop downs, restore the default setting of Enable Dynamic Dropdowns back to 'On for Multi-Attribute Only' and be sure that Product Info Multiple Attribute Display Plugin is set for sba_sequenced_dropdowns or an option that supports display of information when a product has multiple option names associated with it.
It also looks like some aspect of the javascript code has not been loaded/incorporated correctly as there is reference to loading the javascript function i53, but the function is not generated in the code which means that something isn't loading it and when I attempted to review the page code I couldn't find the javascript that would be expected to be generated. That said though, I recommend resolving the above first.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
it does work as it should, but i dont want to show the customid
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
jimmie
it does work as it should, but i dont want to show the customid
Did you read this post. That directly related to not displaying the customid on the catalog side? What was or was not understood in that and perhaps following message(s)?
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
when i have main product quantity set to zero (a red light) tells customer that this product is out of stock and shows a warning in shopping cart. when i put a quantity(Green Light) in main product but have an attribute with no stock they get no warning in the shopping cart. they do see under the product Special ordered but not in header
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
yes i did, tried replacing true to false in all instances nada. 6 spots
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
jimmie
yes i did, tried replacing true to false in all instances nada
Well, it's not a replace true with false, but instead force the logic to not execute adding the customid regardless of the setting of the option.
Also, check the settings under configuration->attribute Settings, SBA Display CustomID in Attribute Dropdowns. It seems for your situation you want that set to Off rather than the default of Always On...
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
jimmie
when i have main product quantity set to zero (a red light) tells customer that this product is out of stock and shows a warning in shopping cart. when i put a quantity(Green Light) in main product but have an attribute with no stock they get no warning in the shopping cart. they do see under the product Special ordered but not in header
I don't know what code you are using the generate one thing or another, but if you are inspecting the stock available of a product in the cart, then there may be some modification needed. ie. if the attributes that have been selected are passed with the product's id to the function zen_get_products_stock, then a zero or negative value will indicate out of stock or already on back order.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Okay, so, I feel that I need to apologize. There have previously been some reports of multi-attribute product being slow to load on the prduct page, but I hadn't been able to reproduce the specific issue until now. A zenner with whom I've spoken a few times over the couple of years came to me looking for some assistance and to see if there was someone that could help. Pretty plainly it was shown that two product having equivalent attributes, one tracked by Stock By Attributes, the other not had significantly different load times. Testing was doen on a mobile device and a laptop.
Anyways, I was allowed to make a copy of the files and database associated with the store and after seeing how a few different changes in operation could affect the speed, I went on to examine the queries used/generatd and saw how there were several ~15000 queries executed to just load the product page. After I applied a little additional logic and reviewed the log of queries generated when loading the product information page of a product, I found a few changes that could be made, that appear to reduce the overall page load time with little to no real changes in the code. The changes significantly reduced the speed of the page load.
You can see the specific changes at: https://github.com/mc12345678/Stock_...dd4f20790e07e5
or: https://github.com/mc12345678/Stock_...mmit/speed-up/
I have also loaded several other changes and improvements (that follow the above) and can be found at:
https://github.com/mc12345678/Stock_...ombined/master
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
mc12345678
Thanks for working on this. I have been trying but to no avail yet on my own!
For the files you have here in the Combined - if I am running 1.5.5, do I just use the files in the 1_5_5 folder, or also the ones in the top level folders of admin and includes? Clearly there are overwrites if I use both. Do I just dump the files from 1.5.5 in the top folders for the full combined files?
Thanks,
Chris
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
gohealth
Thanks for working on this. I have been trying but to no avail yet on my own!
For the files you have here in the Combined - if I am running 1.5.5, do I just use the files in the 1_5_5 folder, or also the ones in the top level folders of admin and includes? Clearly there are overwrites if I use both. Do I just dump the files from 1.5.5 in the top folders for the full combined files?
Thanks,
Chris
Being open source software, the possibilities are endless of what changes have been made to what files for what reasons. For a store that is "fresh" out-of-the-box, generally the files can be transferred to overwrite existing files if they exist, but, where the same file exists on the server as in the plugin, it is advised that the files either be compared to the current file or to a vanilla version of the original file. In either case, the goal is to identify what was modified to provide the associated functionality. Where changes have been made to the original file, I have tried to provide a comment in the file, though I expect I have missed one or more here and there.
So, regarding the files needed for operation, the files in the base includes and admin folders are common to all currently posted and supported versions. There are a few template override files in the includes folder. Then, there are the files that are specific to the associated version(s). For 1.5.3 and 1.5.4, the differences were so small that it didn't seem worth trying to maintain two different folders.
The core functionality is provided in those first two folders, after that, well, some might call some of the version specific files bells and whistles. :) the core files should be loaded first and even ideally the install executed. Operation should remain supported (though at reduced effect) until the version files are incorporated.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
I was told this would do what I need. I have a vinyl decal business. Say I have 50 colors. 100 products. I have the colors and type of vinyl all setup in attributes. this all works great. What I'm looking for is if I sale out of two colors, I want to be able to mark that color out of stock across the board and not have to update each product.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
cubmanky
I was told this would do what I need. I have a vinyl decal business. Say I have 50 colors. 100 products. I have the colors and type of vinyl all setup in attributes. this all works great. What I'm looking for is if I sale out of two colors, I want to be able to mark that color out of stock across the board and not have to update each product.
There's a couple of ways to get the final result (the two colors not being available), but the admin control at this time does not have necessarily a "click this" to disable the option value across all product. (If you can imagine the multiple different ways attributes can be applied, you may understand why this specific case has not yet been incorporated.)
At any rate, the first question to this is are the 100 product truly individual product in the store? If so, do they have only the color attribute or some additional attribute? Then once a color is not available, do you want the option to still show in the list (out-of-stock or similar) or do you not want it to appear at all? Is stock actually maintained in Zen Cart for these color/product combinations or is it more of a go/no go?
Answers to those will help me identify one or more ways that the action can be accomplished now and perhaps something developed for future use.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
are the 100 product truly individual product in the store?
yes each item is a new product
If so, do they have only the color attribute or some additional attribute?
Color only.
Then once a color is not available, do you want the option to still show in the list (out-of-stock or similar) or do you not want it to appear at all?
I like the out of stock option, but open to it now showing also.
Is stock actually maintained in Zen Cart for these color/product combinations or is it more of a go/no go?
I would say more of a go no go. Where I can go in and mark a color out of stock.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
cubmanky
are the 100 product truly individual product in the store?
yes each item is a new product
If so, do they have only the color attribute or some additional attribute?
Color only.
Then once a color is not available, do you want the option to still show in the list (out-of-stock or similar) or do you not want it to appear at all?
I like the out of stock option, but open to it now showing also.
Is stock actually maintained in Zen Cart for these color/product combinations or is it more of a go/no go?
I would say more of a go no go. Where I can go in and mark a color out of stock.
Ok. So. First overall issue I see for this method of implementation as it relates to the current options made available is initially populating all of the product with the associated color attribute "quickly". Now, I haven't gone through the export/import feature that potteryhouse had incorporated in a while, but it seemed to be written with single attribute (color) type functionality and likely could help with that aspect.
So, how to address the rest. Once the color is associated with the product and a quantity of at least 1 is applied (assuming that the stock configuration settings are such not to decrease the quantity), then if want to show the out-of-stock option, a sql query would need to be written to set all of the item's attribute to a quantity of 0. If wanted to just not display the color option, then could use the catalog->iption Values manager to delete the color option from all product (problem there is that when it came back in stock it would also need to be added back to all product which can be done in much the same way but then also have to add back to the attribute tracking section).
Now if the product had not yet been generated, there is the ability to copy attributes from an existing product to the new product including those tracked by SBA.
If the sql route were used, a similar sql statement would be used to change the stock quantity to 1 (or whatever number) when the product came back in stock.
It can also be set to not show the out-of-stock attributes.
Now, I did just think/remember something. Not that long ago, I added a feature that would allow designating that an attribute was not tracked by stock (meaning can get indefinitely until it was turned off), which is a lot like you are seeking. Currently it is controlled only by sql statements, but it supports the ability of saying that an option value is in stock for all product (or all product that have a given option name (color)). The display and management of that feature hasn't been developed yet because the full possibilities haven't quite yet been realized. Didn't want to create something that was going to be difficult to expand upon and would prefer the interface to be understandable.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
mc12345678
I have applied the above changes to a v1.5.5f site, it seems that the changes to includes/classes/class.products_with_attributes_class_stock.php are causing problems. The error I get when adding a SBA attributed product to the cart (from the product info page) is
Code:
[23-Sep-2018 15:08:12 Europe/London] Request URI: /my-category/my-product?number_of_uploads=0&action=add_product, IP address: 127.0.0.1
#1 trigger_error() called at [\www\mydomain.co.uk\includes\classes\class.products_with_attributes_class_stock.php:793]
#2 products_with_attributes_class_stock->zen_sba_attribs_no_text() called at [\www\mydomain.co.uk\includes\extra_cart_actions\stock_by_attributes.php:787]
#3 include(\www\mydomain.co.uk\includes\extra_cart_actions\stock_by_attributes.php) called at [\www\mydomain.co.uk\includes\main_cart_actions.php:26]
#4 require(\www\mydomain.co.uk\includes\main_cart_actions.php) called at [\www\mydomain.co.uk\includes\init_includes\init_cart_handler.php:44]
#5 require(\www\mydomain.co.uk\includes\init_includes\init_cart_handler.php) called at [\www\mydomain.co.uk\includes\autoload_func.php:48]
#6 require(\www\mydomain.co.uk\includes\autoload_func.php) called at [\www\mydomain.co.uk\includes\application_top.php:170]
#7 require(\www\mydomain.co.uk\includes\application_top.php) called at [\www\mydomain.co.uk\index.php:26]
[23-Sep-2018 15:08:12 Europe/London] PHP Warning: SBA product can not have any attributes in \www\mydomain.co.uk\includes\classes\class.products_with_attributes_class_stock.php on line 793
[23-Sep-2018 15:08:12 Europe/London] PHP Stack trace:
[23-Sep-2018 15:08:12 Europe/London] PHP 1. {main}() \www\mydomain.co.uk\index.php:0
[23-Sep-2018 15:08:12 Europe/London] PHP 2. require() \www\mydomain.co.uk\index.php:26
[23-Sep-2018 15:08:12 Europe/London] PHP 3. require() \www\mydomain.co.uk\includes\application_top.php:170
[23-Sep-2018 15:08:12 Europe/London] PHP 4. require() \www\mydomain.co.uk\includes\autoload_func.php:48
[23-Sep-2018 15:08:12 Europe/London] PHP 5. require() \www\mydomain.co.uk\includes\init_includes\init_cart_handler.php:44
[23-Sep-2018 15:08:12 Europe/London] PHP 6. include() \www\mydomain.co.uk\includes\main_cart_actions.php:26
[23-Sep-2018 15:08:12 Europe/London] PHP 7. products_with_attributes_class_stock->zen_sba_attribs_no_text() \www\mydomain.co.uk\includes\extra_cart_actions\stock_by_attributes.php:787
[23-Sep-2018 15:08:12 Europe/London] PHP 8. trigger_error() \www\mydomain.co.uk\includes\classes\class.products_with_attributes_class_stock.php:793
To my inexperienced eye it would appear that this code, lines 762 - 788, are behind the issue, only because reverting to the SBA's previous version of this code gives no errors.
PHP Code:
if (!isset($this->_isSBA[(int)$products_id]['sql'])) {
if (PRODUCTS_OPTIONS_SORT_ORDER=='0') {
$options_order_by= ' order by LPAD(popt.products_options_sort_order,11,"0"), popt.products_options_name';
} else {
$options_order_by= ' order by popt.products_options_name';
}
//get the option/attribute list
$sql = "select distinct popt.products_options_id, popt.products_options_name, popt.products_options_sort_order,
popt.products_options_type, popt.products_options_length, popt.products_options_comment,
popt.products_options_size,
popt.products_options_images_per_row,
popt.products_options_images_style,
popt.products_options_rows
from " . TABLE_PRODUCTS_OPTIONS . " popt
left join " . TABLE_PRODUCTS_ATTRIBUTES . " patrib ON (patrib.options_id = popt.products_options_id)
where patrib.products_id= :products_id:
and popt.language_id = :languages_id: " .
$options_order_by;
$sql = $db->bindVars($sql, ':products_id:', $products_id, 'integer');
$sql = $db->bindVars($sql, ':languages_id:', $_SESSION['languages_id'], 'integer');
$products_options_names = $db->Execute($sql);
$this->_isSBA[(int)$products_id]['sql'] = $products_options_names;
} else {
$products_options_names = $this->_isSBA[(int)$products_id]['sql'];
}
There doesn't seem to be anything special about the product's attributes. Product is priced by attributes, one dropdown option name with three option values (the first of which is display only)
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Should have added to the above post my setup details are:
v1.5.5.f (PHP 7.1.9)
Database: MySQL 5.5.5-10.2.8-MariaDB
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
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
simon1066
I have applied the above changes to a v1.5.5f site, it seems that the changes to includes/classes/class.products_with_attributes_class_stock.php are causing problems. The error I get when adding a SBA attributed product to the cart (from the product info page) is
Code:
[23-Sep-2018 15:08:12 Europe/London] Request URI: /my-category/my-product?number_of_uploads=0&action=add_product, IP address: 127.0.0.1
#1 trigger_error() called at [\www\mydomain.co.uk\includes\classes\class.products_with_attributes_class_stock.php:793]
#2 products_with_attributes_class_stock->zen_sba_attribs_no_text() called at [\www\mydomain.co.uk\includes\extra_cart_actions\stock_by_attributes.php:787]
#3 include(\www\mydomain.co.uk\includes\extra_cart_actions\stock_by_attributes.php) called at [\www\mydomain.co.uk\includes\main_cart_actions.php:26]
#4 require(\www\mydomain.co.uk\includes\main_cart_actions.php) called at [\www\mydomain.co.uk\includes\init_includes\init_cart_handler.php:44]
#5 require(\www\mydomain.co.uk\includes\init_includes\init_cart_handler.php) called at [\www\mydomain.co.uk\includes\autoload_func.php:48]
#6 require(\www\mydomain.co.uk\includes\autoload_func.php) called at [\www\mydomain.co.uk\includes\application_top.php:170]
#7 require(\www\mydomain.co.uk\includes\application_top.php) called at [\www\mydomain.co.uk\index.php:26]
[23-Sep-2018 15:08:12 Europe/London] PHP Warning: SBA product can not have any attributes in \www\mydomain.co.uk\includes\classes\class.products_with_attributes_class_stock.php on line 793
[23-Sep-2018 15:08:12 Europe/London] PHP Stack trace:
[23-Sep-2018 15:08:12 Europe/London] PHP 1. {main}() \www\mydomain.co.uk\index.php:0
[23-Sep-2018 15:08:12 Europe/London] PHP 2. require() \www\mydomain.co.uk\index.php:26
[23-Sep-2018 15:08:12 Europe/London] PHP 3. require() \www\mydomain.co.uk\includes\application_top.php:170
[23-Sep-2018 15:08:12 Europe/London] PHP 4. require() \www\mydomain.co.uk\includes\autoload_func.php:48
[23-Sep-2018 15:08:12 Europe/London] PHP 5. require() \www\mydomain.co.uk\includes\init_includes\init_cart_handler.php:44
[23-Sep-2018 15:08:12 Europe/London] PHP 6. include() \www\mydomain.co.uk\includes\main_cart_actions.php:26
[23-Sep-2018 15:08:12 Europe/London] PHP 7. products_with_attributes_class_stock->zen_sba_attribs_no_text() \www\mydomain.co.uk\includes\extra_cart_actions\stock_by_attributes.php:787
[23-Sep-2018 15:08:12 Europe/London] PHP 8. trigger_error() \www\mydomain.co.uk\includes\classes\class.products_with_attributes_class_stock.php:793
To my inexperienced eye it would appear that this code, lines 762 - 788, are behind the issue, only because reverting to the SBA's previous version of this code gives no errors.
PHP Code:
if (!isset($this->_isSBA[(int)$products_id]['sql'])) {
if (PRODUCTS_OPTIONS_SORT_ORDER=='0') {
$options_order_by= ' order by LPAD(popt.products_options_sort_order,11,"0"), popt.products_options_name';
} else {
$options_order_by= ' order by popt.products_options_name';
}
//get the option/attribute list
$sql = "select distinct popt.products_options_id, popt.products_options_name, popt.products_options_sort_order,
popt.products_options_type, popt.products_options_length, popt.products_options_comment,
popt.products_options_size,
popt.products_options_images_per_row,
popt.products_options_images_style,
popt.products_options_rows
from " . TABLE_PRODUCTS_OPTIONS . " popt
left join " . TABLE_PRODUCTS_ATTRIBUTES . " patrib ON (patrib.options_id = popt.products_options_id)
where patrib.products_id= :products_id:
and popt.language_id = :languages_id: " .
$options_order_by;
$sql = $db->bindVars($sql, ':products_id:', $products_id, 'integer');
$sql = $db->bindVars($sql, ':languages_id:', $_SESSION['languages_id'], 'integer');
$products_options_names = $db->Execute($sql);
$this->_isSBA[(int)$products_id]['sql'] = $products_options_names;
} else {
$products_options_names = $this->_isSBA[(int)$products_id]['sql'];
}
There doesn't seem to be anything special about the product's attributes. Product is priced by attributes, one dropdown option name with three option values (the first of which is display only)
I would say that you are correct in the section of code. It would seem that the issue is in the else section of that. The reason I state that is because the first part generates a result from the query and as the error message that is generated suggests, the error message should not be generated when a product is tracked by SBA.
So that leaves one to ask, how then is it that this error is being generated? Well, in the else section, a previous sql result is being accessed. More than likely (which I'll take a closer look at), the query was fully iterated before being stored. What that means is that in order to reuse the result, the query needs to be rewound. Because this software is compatible with older ZC versions, there are two ways to do this.
Changing:
Code:
} else {
$products_options_names = $this->_isSBA[(int)$products_id]['sql'];
}
To:
Code:
} else {
$products_options_names = $this->_isSBA[(int)$products_id]['sql'];
if (method_exists($products_options_names, 'rewind')) {
$products_options_names->Rewind();
} else {
$products_options_names->Move(0);
$products_options_names->MoveNext();
}
}
Will likely resolve the issue for ZC 1.5.5 (in the first section) and pre-ZC 1.5.5 (in the else section that has been added).
Thank you though for reporting this, I hadn't come across such an issue after having addressed other strict associated messages. I did review the list of plugins and considering the error and where it has occurred, I don't believe that they contribute to the issue.
-
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Thank you for the explanation of the function of that new code. I must admit I was struggling to get my head around the logic.
I'll implement your changes and report back if any further problems.