Zen Cart Logo
Forums / All Other Contributions/Addons / Stocks by attributes

Stocks by attributes

Locked

Views: 251,296

Results 581 to 600 of 1,126
This thread is locked. New replies are disabled.
16 Feb 2009, 2:20 AM
#581
kellan4459 avatar

kellan4459

New Zenner

Join Date:
Dec 2008
Posts:
79
Plugin Contributions:
0

Stocks by attributes

krazykev:

Are you using table prefixes - in which case cactus2_zc2.products_with_attributes_stock may really be something like cactus2_zc2.zen_products_with_attributes_stock.

Based on the way the define for the stock attribute table is in code I would believe that Kev is on to something here

define('TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK', DB_PREFIX . 'products_with_attributes_stock');

the DB_PREFIX in the define looks to be the problem.

Kellan

16 Feb 2009, 7:11 AM
#582
cropinstop avatar

cropinstop

New Zenner

Join Date:
Oct 2006
Location:
Surprise Arizona
Posts:
73
Plugin Contributions:
0

Re: Stocks by attributes

Are you absolutely sure it exists? (Check for prefixes)

Should "Join products_with_attributes_stock PWAS" be "join pa.products_with_attributes_stock PWAS" ??

No - this isn't valid SQL.

Are you using table prefixes - in which case cactus2_zc2.products_with_attributes_stock may really be something like cactus2_zc2.zen_products_with_attributes_stock.

yes, am using a table prefix zen. Need to get the glasses fixed:cool:

In fact, to test this theory, I have amended the SQL to use the table define - try this query instead

select pov.products_options_values_id,
pov.products_options_values_name,
pa.*
from " . TABLE_PRODUCTS_ATTRIBUTES . " pa join " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov
on pa.options_values_id = pov.products_options_values_id
join " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " PWAS
on PWAS.stock_attributes = pa.products_attributes_id
where pa.products_id = '" . (int)$_GET['products_id'] . "'
and pa.options_id = '" . (int)$products_options_names->fields['products_options_id'] . "'
and pa.options_values_id = pov.products_options_values_id
and pov.language_id = '" . (int)$_SESSION['languages_id'] . "'
and PWAS.quantity > 0 " .
$order_by;

Post back with your results.

Kev

Tried the revised SQL, and now the out-of stock items are masked from the selection menu, BUT, all selection menus for items that are not "stock by attributes" have the selection list truncated such that no selections are visible. Go to http://offlinestore.azbizp.com/index.php?main_page=product_info&cPath=29_30&products_id=83 for an example.

16 Feb 2009, 8:39 AM
#583
krazykev avatar

krazykev

New Zenner

Join Date:
Jan 2009
Posts:
59
Plugin Contributions:
1

Re: Stocks by attributes

Hi cropinstop,

I see what you mean. I only use one attribute so that SQL works great for me. I will try and replicate your issue but I tihnk I may struggle. You could try a left join on PWAS - see sql below - BUT I HAVEN'T TRIED IT!!!

select pov.products_options_values_id,
pov.products_options_values_name,
pa.*
from " . TABLE_PRODUCTS_ATTRIBUTES . " pa join " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov
on pa.options_values_id = pov.products_options_values_id
LEFT join " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " PWAS
on PWAS.stock_attributes = pa.products_attributes_id
where pa.products_id = '" . (int)$_GET['products_id'] . "'
and pa.options_id = '" . (int)$products_options_names->fields['products_options_id'] . "'
and pa.options_values_id = pov.products_options_values_id
and pov.language_id = '" . (int)$_SESSION['languages_id'] . "'
and PWAS.quantity > 0 " .
$order_by;

17 Feb 2009, 2:20 AM
#584
kellan4459 avatar

kellan4459

New Zenner

Join Date:
Dec 2008
Posts:
79
Plugin Contributions:
0

Re: Stocks by attributes

cropinstop:

yes, am using a table prefix zen. Need to get the glasses fixed:cool:

Tried the revised SQL, and now the out-of stock items are masked from the selection menu, BUT, all selection menus for items that are not "stock by attributes" have the selection list truncated such that no selections are visible. Go to http://offlinestore.azbizp.com/index.php?main_page=product_info&cPath=29_30&products_id=83 for an example.

cropinstop and kev

I use the left join with mine and it works across all items with attributes whether they have their own stock value or not.

example of mine is at

http://www.zen-cart.com/forum/showpost.php?p=682070&postcount=559

17 Feb 2009, 6:27 AM
#585
cropinstop avatar

cropinstop

New Zenner

Join Date:
Oct 2006
Location:
Surprise Arizona
Posts:
73
Plugin Contributions:
0

Re: Stocks by attributes

Change by krazykev did not fix the problem, change by kellan4459 (post 559) seems to be working. Will do more testing offline to see if there are problems.

Thanks

17 Feb 2009, 1:10 PM
#586
krazykev avatar

krazykev

New Zenner

Join Date:
Jan 2009
Posts:
59
Plugin Contributions:
1

Re: Stocks by attributes

Cropinstop,

I guess you have the problem fixed but I would like to understand this better. I am quite new to Zen Cart, so wondered if you could elaborate on your statement

BUT, all selection menus for items that are not "stock by attributes"

What kind of attributes are you using that do not use "stock by attributes" such that they don't get displayed?

Kev

17 Feb 2009, 2:59 PM
#587
kellan4459 avatar

kellan4459

New Zenner

Join Date:
Dec 2008
Posts:
79
Plugin Contributions:
0

Re: Stocks by attributes

krazykev:

Cropinstop,

I guess you have the problem fixed but I would like to understand this better. I am quite new to Zen Cart, so wondered if you could elaborate on your statement

BUT, all selection menus for items that are not "stock by attributes"

What kind of attributes are you using that do not use "stock by attributes" such that they don't get displayed?

Kev

Kev
If I understand him correctly he is using his cart similar to the one I'm doing. In mine their are items that I will allow a qty of 20 no matter which attribute they select so I don't want to limit the cart to
qty 10 for attribute 1
qty 10 for attribute 2
I would prefer a qty 20 for the item as a whole so I could have
5 attribute 1
15 attribute 2
or vice versa

on the other hand I have other items where only so many per time slot so I want each attribute to have a limited qty. hope this makes sense.

17 Feb 2009, 3:31 PM
#588
krazykev avatar

krazykev

New Zenner

Join Date:
Jan 2009
Posts:
59
Plugin Contributions:
1

Re: Stocks by attributes

Hi Kellan,

you lost me a little. I understand what you are trying to achieve, but no idea how you would! So long as everything works I don't suppose it matters! :D

18 Feb 2009, 12:57 AM
#589
kellan4459 avatar

kellan4459

New Zenner

Join Date:
Dec 2008
Posts:
79
Plugin Contributions:
0

Re: Stocks by attributes

for example
we offer a cinderella visit offsite or onsite. The item has a qty of 1000 because it is unlimited. I don't care how many onsite or offsite visits so I want to use the product qty and not specify an individual attribute qty.

You can see the example at
http://www.tks-atl.com/index.php?main_page=product_info&cPath=1_7&products_id=18

Then we offer things like Easter Bunny Pictures where each time slot has a maximum number available. Each time slot is a separate attribute with a qty set for the attribute rather than just the product. When a qty is set for the individual attribute I added code to show the available qty for the individual attribute.

You can see the example at
http://www.tks-atl.com/index.php?main_page=product_info&cPath=8&products_id=68

Hopefully that clears it up a little and is what Cropinstop is also trying to accomplish

18 Feb 2009, 5:57 AM
#590
cropinstop avatar

cropinstop

New Zenner

Join Date:
Oct 2006
Location:
Surprise Arizona
Posts:
73
Plugin Contributions:
0

Re: Stocks by attributes

Concur with Kellan's analysis.

I have items in local inventory where I use stock by attributes to track the availability of each color, size, etc;, but also sell dropshipped items, where I set the quantity for the item, independent of color, to a high number to reflect a virtually unlimited availability (assuming of course my wholesaler does not go belly up in this :censored: economy)

18 Feb 2009, 7:30 AM
#591
cropinstop avatar

cropinstop

New Zenner

Join Date:
Oct 2006
Location:
Surprise Arizona
Posts:
73
Plugin Contributions:
0

Re: Stocks by attributes

Found a combination of attributes that still have a problem (and probably can't be fixed).

Have a product with two sets of attributes - color and size.
setup stock by attributes as follows:

green, small : qty = 10
green, large : qty=10

red, small : qty =10

red, large : qty = 0

When I order red, large, the item is added to the shopping cart with the note it is out of stock, but the sale can be completed as if stock was available.

"configuration:stock:allow checkout" is set to false.

The problem with being able to order out of stock merchandise existed before this fix, and may be a problem unrelated to Stock by Attributes. Ideally, the red/large combination should not be selectable at all.

19 Feb 2009, 1:59 AM
#592
keithlaw avatar

keithlaw

New Zenner

Join Date:
Feb 2006
Location:
Orbost Vic Australia
Posts:
25
Plugin Contributions:
0

Re: Stocks by attributes

http://eastgippslandsports.com.au/index.php?main_page=checkout_shipping

I get a blank page. Error tracking gives this error.

[19-Feb-2009 11:10:26] PHP Fatal error: Cannot redeclare class order in /home/eastgipp/public_html/includes/classes/order.php on line 20

I have checked the uploaded files and I can't see what the problem is. Can we get some help please

19 Feb 2009, 8:41 AM
#593
krazykev avatar

krazykev

New Zenner

Join Date:
Jan 2009
Posts:
59
Plugin Contributions:
1

Re: Stocks by attributes

"Cannot redeclare class order" is implying that a class called "order" has already been declared. Have you installed any other contributions that may use an "order" class?

Kev

19 Feb 2009, 9:00 AM
#594
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Stocks by attributes

The cannot redeclare class error has been addressed several times already in this thread. It's caused either by creating backup files where you've loaded the new files or your FTP program doing it for you.

20 Feb 2009, 1:40 AM
#595
kellan4459 avatar

kellan4459

New Zenner

Join Date:
Dec 2008
Posts:
79
Plugin Contributions:
0

Re: Stocks by attributes

keithlaw:

http://eastgippslandsports.com.au/index.php?main_page=checkout_shipping

I get a blank page. Error tracking gives this error.

[19-Feb-2009 11:10:26] PHP Fatal error: Cannot redeclare class order in /home/eastgipp/public_html/includes/classes/order.php on line 20

I have checked the uploaded files and I can't see what the problem is. Can we get some help please

I had similar issues with Check In/Out creating a lock file that wasn't be cleared. Make sure the program you are using isn't doing something similar.

20 Feb 2009, 1:49 AM
#596
kellan4459 avatar

kellan4459

New Zenner

Join Date:
Dec 2008
Posts:
79
Plugin Contributions:
0

Re: Stocks by attributes

cropinstop:

Found a combination of attributes that still have a problem (and probably can't be fixed).

Have a product with two sets of attributes - color and size.
setup stock by attributes as follows:

green, small : qty = 10
green, large : qty=10

red, small : qty =10

red, large : qty = 0

When I order red, large, the item is added to the shopping cart with the note it is out of stock, but the sale can be completed as if stock was available.

"configuration:stock:allow checkout" is set to false.

The problem with being able to order out of stock merchandise existed before this fix, and may be a problem unrelated to Stock by Attributes. Ideally, the red/large combination should not be selectable at all.

How are these added to the item? do you have a size and a color attribute? Or one attribute that has both size and color in it?

20 Feb 2009, 3:31 AM
#597
keithlaw avatar

keithlaw

New Zenner

Join Date:
Feb 2006
Location:
Orbost Vic Australia
Posts:
25
Plugin Contributions:
0

Re: Stocks by attributes

I seem to have cleared the problem. I removed each of the 6 files that overwrite and replaced them with the originals. AS each one was changed I checked to see if the error persisted. When I had the new system files removed including order.php I then reinstalled the add on files making sure that only one copy was on file. It is now working but I'm still unsure as what was the original problem. I had repaced the order.php by renaming as order-old.php however I now have renamed to *.php1 so the old files are completely inert.

Thanks for the responses.

20 Feb 2009, 5:49 PM
#598
cropinstop avatar

cropinstop

New Zenner

Join Date:
Oct 2006
Location:
Surprise Arizona
Posts:
73
Plugin Contributions:
0

Re: Stocks by attributes

kellan4459:

How are these added to the item? do you have a size and a color attribute? Or one attribute that has both size and color in it?

There are two sets of attributes:hug:, each on a dropdown list - one list has red/green, and the other small/large.

Was considering making it into one dropdown with the four combinations, but then found another product that has also has two dropdowns, with 5 items in the first set, and 3 in the other. One list with 15 combinations would be very confusing from a buyer's perspective.

20 Feb 2009, 7:07 PM
#599
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Stocks by attributes

keithlaw:

I now have renamed to *.php1 so the old files are completely inert.No they're not. They're still available for inclusion and even if a .php extension is tested for in this specific instance thus excluding them, mixing backup and live files is bad practise and has the potential to get you into trouble elsewhere in Zen Cart (or any other app).

21 Feb 2009, 3:18 AM
#600
kellan4459 avatar

kellan4459

New Zenner

Join Date:
Dec 2008
Posts:
79
Plugin Contributions:
0

Re: Stocks by attributes

cropinstop:

There are two sets of attributes:hug:, each on a dropdown list - one list has red/green, and the other small/large.

Was considering making it into one dropdown with the four combinations, but then found another product that has also has two dropdowns, with 5 items in the first set, and 3 in the other. One list with 15 combinations would be very confusing from a buyer's perspective.

I don't have any items with multiple attributes that are dependent such as size and color so I'm not sure how these get added into the database. I'm guessing at checkout they take the selections and then check the quantity for the selected combination at checkout. So more than likely you will have to create a mechanism that populates the second attribute box dynamically instead of from the product attributes because the quantity is dependent upon the first selection.

I may be making it more difficult than needed. Someone else with experience with multiple dependent attributes may have other suggestions.