Re: 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.
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
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
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?
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
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Code:
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
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
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=543 21">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:
Code:
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
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
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
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
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
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.
Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9
Quote:
Originally Posted by
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