Zen Cart Logo
Forums / All Other Contributions/Addons / Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Views: 658,367

Results 2,241 to 2,260 of 3,609
17 Jun 2015, 2:41 AM
#2241
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Well, nother recent "discovery" between what dalia has pointed out and some further code inspection, the tags around the dropdowns need to be modified and that should "help". Otherwise would suggest deling with the .css to modify the appearance.

I'll see if I can suggest something based on the information previously provided.

26 Jun 2015, 7:52 PM
#2242
malaperth avatar

malaperth

New Zenner

Join Date:
Dec 2013
Location:
Maine
Posts:
77
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Ok, I'm using an older version of SBA 1.53 and some of the "Out of Stock" messages are grey and some of them are black. I can't for the life of me find anywhere it sets a color for the text in a dropdown. Do you know where it is, mc12345678?

Mal

26 Jun 2015, 8:02 PM
#2243
jeking avatar

jeking

Totally Zenned

Join Date:
Oct 2005
Location:
Chicago, IL USA
Posts:
1,592
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Malaperth:

Ok, I'm using an older version of SBA 1.53 and some of the "Out of Stock" messages are grey and some of them are black. I can't for the life of me find anywhere it sets a color for the text in a dropdown. Do you know where it is, mc12345678?

Mal

What is your url with a gray and a black message?

26 Jun 2015, 8:52 PM
#2244
malaperth avatar

malaperth

New Zenner

Join Date:
Dec 2013
Location:
Maine
Posts:
77
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

The site owner had me remove all the 'out of stock' items so at the moment due to a couple orders after a site 'restock', there are only black messages. It must have been something I changed long ago and am too senile to remember! ;)

Mal

26 Jun 2015, 9:16 PM
#2245
malaperth avatar

malaperth

New Zenner

Join Date:
Dec 2013
Location:
Maine
Posts:
77
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

		if($products_options->fields['products_quantity'] > 0){
								$PWA_STOCK_QTY = PWA_STOCK_QTY . $products_options->fields['products_quantity'] . ' ';
							}
							else{
								$products_options->fields['products_options_values_name'] = PWA_OUT_OF_STOCK . $products_options->fields['products_options_values_name'];
							}

I know more about nuclear physics (which is nothing) than I do about databases and am embarrassed to essentially be asking for someone to write code for me, but basically what I want to happen is that if there are items available, complete the if statement, but if the stock is 0, change the code in red so it removes that entire attribute from the database. Anyone care to help a senile old fart, or point me in a direction so I can figure it out by myself? I've been looking for sections of code that do that, but can't seem to find any (again, I'm using a very old version of 1.53 of SBA).

Mal

26 Jun 2015, 10:09 PM
#2246
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Malaperth:

but basically what I want to happen is that if there are items available, complete the if statement, but if the stock is 0, change the code in red so it removes that entire attribute from the database. Anyone care to help a senile old fart, or point me in a direction so I can figure it out by myself? l

What you are trying to do here is not exactly an "easy" task.

About the best I can do with the time available to me is direct you to how the SBA module itself does this. In simple terms, the SAB page/code itself
/admin/products_with_attributes_stock.php creates links to the attribute to be deleted.

These links read like:
<a href="http://yourdomain.com/youradmin/products_with_attributes_stock.php?action=delete&products_id=1234&attributes=54321">Delete Variant</a>

So in theory, it is a matter of determining the products_id and the attributes value from the page where your code is found, inserting these into this URL and then having your code load the /products_with_attributes_stock.php page.

In practice this isn't going to work though, firstly because this is admin related code it won't work from the store front unless you are a logged in admin.
Secondly, if you could run this code from the location indicated it would take the customer away from thier current page to the attributes deletion code, and you'll then need some way to direct them back to where they were, so as I say, this method won't work.

Now having said that, the /products_with_attributes_stock.php code itself has everything that is needed to safely perform these deletions, so you could copy the relevant part of the code and create a 'function' from it specifically for this task, and that will overcome the problems I've just mentioned.

Your code snippet could then be coded something like:

 if($products_options->fields['products_quantity'] > 0){                                $PWA_STOCK_QTY = PWA_STOCK_QTY . $products_options->fields['products_quantity'] . ' ';
                            }
                            else{
 my_delete_function($productID, $arributeValue) ;  


                            }

Now having said that, do you really want the attributed product deleted, or are you happy for them to simply not been shown to the customer?

Although difficult to say without testing/checking, if you are happy to just have them not be shown, you could probably just comment out your line
that reads
$products_options->fields['products_options_values_name'] = PWA_OUT_OF_STOCK . $products_options->fields['products_options_values_name'];

and the out of stock item(s) won't appear in the list.

At least that's the theory.

Cheers
RodG

26 Jun 2015, 10:47 PM
#2247
malaperth avatar

malaperth

New Zenner

Join Date:
Dec 2013
Location:
Maine
Posts:
77
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Thanks, RodG! A direction I asked for and a direction I got! Can't ask for much more than that! And, if I can't figure out how to actually delete it, the customer will never know it isn't deleted if she doesn't see it... ;)

Mal

29 Jun 2015, 5:37 PM
#2248
malaperth avatar

malaperth

New Zenner

Join Date:
Dec 2013
Location:
Maine
Posts:
77
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

jeking:

What is your url with a gray and a black message?

Jeking, go to sweetsagescents.com, click on the Wax Tarts category and check out the dropdown on the product SALE, SALE, SALE Sale Scent Shots. The first out of stock is in black type, the rest are 'greyed out'. At this point, I don't have the time to do any debugging or even look at the tools that are available in Firefox, but at least now you can see what I mean and that I'm not crazy (well, not for that reason anyway... ;) ).

Mal

29 Jun 2015, 6:22 PM
#2249
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Malaperth:

Jeking, go to sweetsagescents.com, click on the Wax Tarts category and check out the dropdown on the product SALE, SALE, SALE Sale Scent Shots. The first out of stock is in black type, the rest are 'greyed out'. At this point, I don't have the time to do any debugging or even look at the tools that are available in Firefox, but at least now you can see what I mean and that I'm not crazy (well, not for that reason anyway... ;) ).

Mal

Answer is that the single dropdown (single attribute) code incorporates disabling of out-of-stock items (this was code implemented to the SBA dropdown attribute type. If not mistaken if the attribute type for products such as this is instead chosen as a standard dropdown, then the greying will not occur.

For multiple attributes, (two or more dropdowns), something like this is in the works for incorporation, but is expected to involve admin controllable options because of the potential complexity of ways to be presented.

29 Jun 2015, 7:14 PM
#2250
malaperth avatar

malaperth

New Zenner

Join Date:
Dec 2013
Location:
Maine
Posts:
77
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

mc12345678:

Answer is that the single dropdown (single attribute) code incorporates disabling of out-of-stock items (this was code implemented to the SBA dropdown attribute type. If not mistaken if the attribute type for products such as this is instead chosen as a standard dropdown, then the greying will not occur.

For multiple attributes, (two or more dropdowns), something like this is in the works for incorporation, but is expected to involve admin controllable options because of the potential complexity of ways to be presented.

Well, I have not been able to find the admin 'command' or whatever you wish to call it for simply not showing out of stock items, and when creating the attribute, I change nothing as far as the select itself, I just add the attribute name and insert it, then add values. My issue is that something seems to be following two code paths (which I easily could have screwed up myself by editing the wrong thing or doing it the wrong way long ago) since some come out black and some grey.

Mal

16 Jul 2015, 6:04 PM
#2251
invizix avatar

invizix

New Zenner

Join Date:
Oct 2007
Posts:
27
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Malaperth:

Jeking, go to sweetsagescents.com, click on the Wax Tarts category and check out the dropdown on the product SALE, SALE, SALE Sale Scent Shots. The first out of stock is in black type, the rest are 'greyed out'. At this point, I don't have the time to do any debugging or even look at the tools that are available in Firefox, but at least now you can see what I mean and that I'm not crazy (well, not for that reason anyway... ;) ).

Mal

Not sure what version of Zen Cart you're using but in Zen Cart 1.5.4 if you don't want them to grey out then you have the set Configuration > Stock > Allow Checkout = True. However it will do as it says, allow customers to checkout even though the item is not in stock. I recommend to keep it set to False though just for the overall customer experience.

16 Jul 2015, 9:38 PM
#2252
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Invizix:

Not sure what version of Zen Cart you're using but in Zen Cart 1.5.4 if you don't want them to grey out then you have the set Configuration > Stock > Allow Checkout = True. However it will do as it says, allow customers to checkout even though the item is not in stock. I recommend to keep it set to False though just for the overall customer experience.

I've added the "greying" out of the options for multiple attributes for when out-of-stock items is displayed and meets a few other conditions for consistency between multiple attributes and single. The grey out on the single attributes was to prevent selection of the out-of-stock item(s) when not allowed to add an out-of-stock item to the cart both for functionality and appearance. Now that there is more cart control to the code, that grey out option technically could be made a selectable choice. Seems that it should be a css controlled aspect, but information varies through internet searches depending on the browser used by the visitor and the version of that browser.

Haven't uploaded this changed code as I want to tackle a couple of other things first and have had some work to do for other clients. Should have it up hopefully soon though.

16 Jul 2015, 11:07 PM
#2253
malaperth avatar

malaperth

New Zenner

Join Date:
Dec 2013
Location:
Maine
Posts:
77
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

mc12345678:

I've added the "greying" out of the options for multiple attributes for when out-of-stock items is displayed and meets a few other conditions for consistency between multiple attributes and single. The grey out on the single attributes was to prevent selection of the out-of-stock item(s) when not allowed to add an out-of-stock item to the cart both for functionality and appearance. Now that there is more cart control to the code, that grey out option technically could be made a selectable choice. Seems that it should be a css controlled aspect, but information varies through internet searches depending on the browser used by the visitor and the version of that browser.

Haven't uploaded this changed code as I want to tackle a couple of other things first and have had some work to do for other clients. Should have it up hopefully soon though.

The code is functioning as it is supposed to and putting the item out of stock. The issue was literally the difference between the color of the "Out of Stock" message itself. In some parts it is black and in some parts it is grey. I cannot find the place(s) that it sets the colors in the css file or where it is set programatically, that is my issue. My apologies for not making that clear earlier. I am just confused since it must somehow be following two different code paths and I cannot find either.

Mal

17 Jul 2015, 1:44 AM
#2254
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Malaperth:

The code is functioning as it is supposed to and putting the item out of stock. The issue was literally the difference between the color of the "Out of Stock" message itself. In some parts it is black and in some parts it is grey. I cannot find the place(s) that it sets the colors in the css file or where it is set programatically, that is my issue. My apologies for not making that clear earlier. I am just confused since it must somehow be following two different code paths and I cannot find either.

Mal

To help a little further considering that this has been requested before in one way or another, please provide a product link to two products that meet the following criteria:

  1. Each product has one attribute.
  2. Each product has at least one selection that is out of stock.
  3. Both links are on the same site.
  4. Each link points to a different product where one shows an out-of-stock option as greyed out the other to a product that shows the "black" attribute for the out-of-stock option.

If product does not match the above criteria, then the issue is being addressed through the greying out option described above.

17 Jul 2015, 7:13 PM
#2255
malaperth avatar

malaperth

New Zenner

Join Date:
Dec 2013
Location:
Maine
Posts:
77
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

mc12345678:

To help a little further considering that this has been requested before in one way or another, please provide a product link to two products that meet the following criteria:

  1. Each product has one attribute.
  2. Each product has at least one selection that is out of stock.
  3. Both links are on the same site.
  4. Each link points to a different product where one shows an out-of-stock option as greyed out the other to a product that shows the "black" attribute for the out-of-stock option.

If product does not match the above criteria, then the issue is being addressed through the greying out option described above.

sigh... It figures. I update the site every Friday and just finished. It was present when I sent the reply to Jeking earlier in the thread and there were grey and black out-of-stock messages in the same dropdown (single attribute, same site). I will PM you when it happens again.

Mal

17 Jul 2015, 7:18 PM
#2256
malaperth avatar

malaperth

New Zenner

Join Date:
Dec 2013
Location:
Maine
Posts:
77
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Invizix:

Not sure what version of Zen Cart you're using but in Zen Cart 1.5.4 if you don't want them to grey out then you have the set Configuration > Stock > Allow Checkout = True. However it will do as it says, allow customers to checkout even though the item is not in stock. I recommend to keep it set to False though just for the overall customer experience.

Invizix, it was the color of the text and not the functionality which is why I mentioned grey and black text. I should not have used the term "greyed out" as that has other connotations.

Mal

18 Jul 2015, 11:44 AM
#2257
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

simon1066:

Zen v1.54
SBA v1.54
Zen Magnific v1.5
DPU v3.0.2

I been attempting to debug the 'second SBA dropdown not working' on my site. Looking at the thread I can see that a couple of things have been tried i.e. validating the page to sort problems with broken tags etc - done. Incorporating an edit by mc12345678 into pad_sba_sequenced_dropdowns - done I'm using the latest from github.

I think I've now isolated the problem to a conflict with Dynamic Price Updater, if I turn it off then the SBA dropdowns work. As there are no common files between the two mods I think it might be a jscript issue. I've been looking for conflicts as much as I'm able but still no joy.

It's time to ask for help. Has anyone had this conflict between the two mods?

I have it on a test site if it helps and would rather PM you the link if you don't mind.

Here's a post I made to the wrong thread by mistake, quoting it here as it belongs here.

19 Jul 2015, 7:46 AM
#2258
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Ok, fresh install of zencart 1.54, DPU_3.0.2 & stock_by_attribute_1.5.4-mc12345678_ZC154

the second dropdown of sba_sequenced_dropdowns does not populate, turn off DPU and it works. So regardless of my other confused posts in SBA threads - I'm probably not losing it.

Dynamic Dropdown settings:

Enable Dynamic Dropdowns 2
Product Info Single Attribute Display Plugin multiple_dropdowns
Show Out of Stock Attributes True
Product Info Multiple Attribute Display Plugin sba_sequenced_dropdowns
Mark Out of Stock Attributes Right
Display Out of Stock Message Line True
Prevent Adding Out of Stock to Cart True
SBA Number of Records to Displayed 25

Settings in admin/catalog/products_with_attributes_stock_(SBA)

  • added attribute quantities in for product_id 1 (Matrox G200 MMS) - 'All attributes combo for both 'model' and 'memory' option names - quantity '1',
  • synced quantities

DPU settings

Dynamic Price Updater Status false
Dynamic Price Updater Version 3.0
Where to display the price productPrices
cart_quantity
Where to display the weight productWeight
show a small loading graphic true
Show currency symbols true
Show product quantity false
Where to display the second price cartAdd

mc12345678, as it seems you are doing most of the current work on this mod, perhaps you can use this information to debug SBA or perhaps DPU which I think is Design75/Chrome's contribution.

Surprising that I might be the first to highlight this, these two excellent mods go so well together - but then I think the dynamic dropdowns are a relatively new inclusion into SBA, I could be mistaken though.

cheers

Simon

19 Jul 2015, 2:27 PM
#2259
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Reading this now trying to pay attention to all of the details. First thing I see is that using the branch that is not currently up-to-date with the master... Nice try, but the mc12345678_ZC154 branch is now like 6 commits behind the master (https://github.com/potteryhouse/stock_by_attribute_1.5.4/compare/mc12345678_ZC154...master). It might explain some of the non-functionality seen as there were still a few thiings presented javascriptwise that were causing issues... Yes, yes, yes I get it that so many things to keep up with and possibly confusing, and and and... We're all doing what we can with the "free" time available as energy is focused on those things that provide income... (This last part is/was not exactly pointed at you simon1066, but I can read the signs of things to come... :P)

As still working on some of the fundamentals of the code to ensure the stability and groundwork needed to support such additional plugins, I have had a go with that one (though expect it to be a huge plus to the code)

Anyways, long and short, may I suggest trying the master branch and then providing the detailed feedback that would be necessary to resolve issues of that branch.

19 Jul 2015, 2:37 PM
#2260
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Correction (key presses not registered and then ran out of time to save the edit):

As still working on some of the fundamentals of the code to ensure the stability and groundwork needed to support such additional plugins, I have NOT had a go with that one (though expect it to be a huge plus to the code)