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,733

Results 381 to 400 of 3,609
8 Apr 2008, 2:27 AM
#381
adoy avatar

adoy

New Zenner

Join Date:
Feb 2008
Posts:
45
Plugin Contributions:
0

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

adoy:

@kuroi

i really appreciate this mod and currently using it on my site. is there any conflict on it with mod dual pricing / wholesale pricing?

a thread on the prob i encountered is found here: http://www.zen-cart.com/forum/showthread.php?t=35450&page=20&highlight=dual+pricing

thankz!

my issue is that my wholesale pricing is NOT working when the product is priced by attributes.

i restored my previous database and remove the files for Stock by Attributes and there it works. please help me solve this. i need to use Stock by Attributes with Wholesale pricing mods simultaneously.

adoy

10 Apr 2008, 8:39 PM
#382
wireyourworld avatar

wireyourworld

New Zenner

Join Date:
Mar 2008
Location:
Stuart FL USA
Posts:
28
Plugin Contributions:
0

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

SIgh, I made it to page 14 of this thread. I even double checked the baby steps on page 12. I'm 99.9% sure I have uploaded all files to relevant folders. Yes the mod is still not showing up under the catelog menu.

I'm at a complete loss with this one. I've reuploaded several times to the point that it keeps popping up the "this file already exists do you want to overwrite it?" .

Still nothing. I've had success with another mod so I'm confused as to why I can't get this one running. And I really need it.

Which is the file, and where should it be, the file that actually tells the menu option to show up? Perhaps that will give me a clue as to a file I missed.

Otherwise, does anyone have any ideas where I'm going wrong?

10 Apr 2008, 9:45 PM
#383
wireyourworld avatar

wireyourworld

New Zenner

Join Date:
Mar 2008
Location:
Stuart FL USA
Posts:
28
Plugin Contributions:
0

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

Nevermind, I seem to say that alot here :-) This is what happened. I was using Filezilla to upload the files. Filezilla was NOT overwriting the files as I commanded. I noticed when the file I was trying to upload, one that should overwrite another one, was a larger filesize than the corresponding one. And when it said the upload was successful, the file size uploaded hadn't changed to the new filesize. I had to DELETE each of the existing files and upload the Stock By Attribute file, fresh as it were.

I'm taking the rest of the night off!

Cynthia

http://www.wireyourworld.com

10 Apr 2008, 9:53 PM
#384
kuroi avatar

kuroi

Totally Zenned

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

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

2PT:

I just can't seem to get it working. Any ideas?Your description of the need to over-write files and the duplication error when you try to re-apply the patch all sound like what I would expect from a correct installation.

Did you have to over-ride the files the first time you uploaded them?

Could you be more specific about what symptoms you are seeing that make you believe that it's not working?

10 Apr 2008, 10:11 PM
#385
kuroi avatar

kuroi

Totally Zenned

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

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

adoy:

my issue is that my wholesale pricing is NOT working when the product is priced by attributes.

i restored my previous database and remove the files for Stock by Attributes and there it works. please help me solve this. i need to use Stock by Attributes with Wholesale pricing mods simultaneously.

adoyI've never used dual pricing, but a quick look at the code suggests no overlap between the code for that mod and the code for stock by attributes and therefore no reason why they shouldn't work together.

It wouldn't however surprise me if there was clash between dual pricing and pricing by attributes where it would be easy to see how the code might overlap.

10 Apr 2008, 10:24 PM
#386
kuroi avatar

kuroi

Totally Zenned

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

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

xRobVx818:

I'm having a the same problem where my admin settings are set to "false" for allow checkout. but customers are able to checkout. at the shopping cart customers are correctly informed about how many items are in stock for the item with the specific attribute, if they try to order more than available, but they can still checkout.

I really doubt i have any backup files, but where would they be and what files are typically backed up?

I have reinstalled all the files using filezilla, 1st I originally used windows explorer. So that shouldn't be the issue.

I'm using a custom template, and the paypal module.Does you customer template over-ride any of the files in the stock by attributes mod?

Spurious backup files are usually created by well-intentioned Zen Cart users who don't realise what they are doing, so it's not possible to tell you where they might be, but it doesn't sound as though you have made any.

10 Apr 2008, 10:30 PM
#387
kuroi avatar

kuroi

Totally Zenned

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

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

wireyourworld:

Nevermind, I seem to say that alot here :-) This is what happened. I was using Filezilla to upload the files. Filezilla was NOT overwriting the files as I commanded. I noticed when the file I was trying to upload, one that should overwrite another one, was a larger filesize than the corresponding one. And when it said the upload was successful, the file size uploaded hadn't changed to the new filesize. I had to DELETE each of the existing files and upload the Stock By Attribute file, fresh as it were.

I'm taking the rest of the night off!

Cynthia

http://www.wireyourworld.comHi Cynthia

Thanks for posting back about this. Problems uploading and/or successfully over writing files is by far the biggest reason why this mod sometimes appears not to work.

In the days when I was still prepared to have a look at sites where it wasn't working, some 80-90% had this problem, even when their owners were convinced that they had uploaded the files correctly. So congratulations to you for being eagled-eyed enough to spot and correct the problem yourself.

11 Apr 2008, 3:41 AM
#388
wireyourworld avatar

wireyourworld

New Zenner

Join Date:
Mar 2008
Location:
Stuart FL USA
Posts:
28
Plugin Contributions:
0

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

You're welcome! Surprising I noticed it today given my lack of sleep. Sheer determination (or stubborness). IMO this potential situation of uploading might be a good note to add to your readme. As well as those baby steps on page 12, I thought I did it right but it was nice to see it confirmed by your post there. :-) I too didn't know what the heck to do with the sql, I just guessed (correctly fortunately).

Cynthia

11 Apr 2008, 4:48 AM
#389
2pt avatar

2pt

New Zenner

Join Date:
Mar 2008
Location:
British Columbia
Posts:
7
Plugin Contributions:
0

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

kuroi:

Your description of the need to over-write files and the duplication error when you try to re-apply the patch all sound like what I would expect from a correct installation.

Did you have to over-ride the files the first time you uploaded them?

Could you be more specific about what symptoms you are seeing that make you believe that it's not working?

Thank you so much for replying! The first time I tried to upload the files, I put the whole thing in my public_html as its own folder. Then I put the files into the main folders of the site. It still didn't work. So I went back and upload the individual files into the admin and includes files of my public_html and emptied the separate Stock by attributes file.

I now have Products with Attribute Stock at the bottom of the Admin>Catalog drop down menu. YAAAAHH! And I can enter the amounts.

However, I don't see the Show Stock when Low line under Configuration>Stock.

Customers are not informed as to how much stock is left if they request more than is available and they are able to checkout even though we don't have the stock.

In Configuration>Stock my settings are
Check stock level True
Subtract Stock True
Allow Checkout False

I'm sorry if you've answered this problem before. After about post #150 my eyes started to glaze over:shocking:

Thanks again for any help!

11 Apr 2008, 2:29 PM
#390
kuroi avatar

kuroi

Totally Zenned

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

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

@2PT

Try cutting, pasting and executing just this bit into your Admin > Tools > Install SQL Patches page. I don't expect it to be a complete solution, but it may help your forward a step and give clues as to what the issue is.

INSERT INTO configuration (configuration_title, configuration_key, configuration_value,
configuration_description, configuration_group_id, sort_order,
last_modified, date_added, use_function, set_function)
VALUES ('Show available stock level in cart when less than order', 'STOCK_SHOW_LOW_IN_CART', 'false',
'When customer places more items in cart than are available, show the available amount on the shopping cart page:',
'9',
'6',
NULL,
now(),
NULL,
"zen_cfg_select_option(array('true', 'false'),"
);

11 Apr 2008, 4:35 PM
#391
wireyourworld avatar

wireyourworld

New Zenner

Join Date:
Mar 2008
Location:
Stuart FL USA
Posts:
28
Plugin Contributions:
0

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

Re: 2PT In Configuration>Stock Mine says "Show available stock level in cart when less than order". is that the same thing?

14 Apr 2008, 1:25 AM
#392
brokensilence avatar

brokensilence

New Zenner

Join Date:
Apr 2008
Posts:
12
Plugin Contributions:
0

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

I would like to take a moment to reflect on the concept of restocking a deleted order:

I thought this would be a wonderful idea (even though 1.4 is going to implement inventory based on attributes, there are folks out there who need / want it now).

It all lies in the /admin/includes/functions/general.php (and please correct me if I missed or overlooked something)

Very simply, in the function zen_remove_order replace, the declaration line with this

function zen_remove_order($order_id, $restock = false, $stock_by_attribute = false) {

In the function, in the check for $restock, add this check:

if($stock_by_attribute == 'on')
    {
   	 $order_stock_by_att = $db->Execute("select op.products_id, op.products_quantity,
         						 opa.products_options_id, opa.products_options_values_id
                                from " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " opa
                                where op.orders_id = '" . (int)$order_id . "'
   							 AND opa.orders_id = op.orders_id ");
   	
   	 
   	 $options_id = $order_stock_by_att->fields['products_options_id'];
   	 $options_values_id = $order_stock_by_att->fields['products_options_values_id'];
   	 $prod_id = $order_stock_by_att->fields['products_id'];
   	 while(!$order_stock_by_att->EOF){
   

   	  
   	  $attribute_stock_sql = "select pas.stock_id from " .
   	  									TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pas, ". TABLE_PRODUCTS_ATTRIBUTES ." pa
   										where pa.options_id = '$options_id'
   										and pa.options_values_id = '$options_values_id'
   										and pa.products_attributes_id = pas.stock_attributes 
   										and pas.products_id = '$prod_id' ";
   	  $attribute_stock = $db->Execute($attribute_stock_sql);

         $db->Execute("update ".TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " set 
   	  				quantity = quantity + " .$order_stock_by_att->fields['products_quantity'] . "
   	  				 where stock_id = '".$attribute_stock->fields['stock_id']."'");
   	  $order_stock_by_att->MoveNext();
   	}

    }

The final function should look something like this:

function zen_remove_order($order_id, $restock = false, $stock_by_attribute = false) {
    global $db;
    if ($restock == 'on') {
      $order = $db->Execute("select products_id, products_quantity
                             from " . TABLE_ORDERS_PRODUCTS . "
                             where orders_id = '" . (int)$order_id . "'");

      while (!$order->EOF) {
        $db->Execute("update " . TABLE_PRODUCTS . "
                      set products_quantity = products_quantity + " . $order->fields['products_quantity'] . ", products_ordered = products_ordered - " . $order->fields['products_quantity'] . " where products_id = '" . (int)$order->fields['products_id'] . "'");
        $order->MoveNext();
      }
      

	 if($stock_by_attribute == 'on')
	 {
		 $order_stock_by_att = $db->Execute("select op.products_id, op.products_quantity,
	      						 opa.products_options_id, opa.products_options_values_id
	                             from " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " opa
	                             where op.orders_id = '" . (int)$order_id . "'
								 AND opa.orders_id = op.orders_id ");
		
		 $temp_string = "";
		 $options_id = $order_stock_by_att->fields['products_options_id'];
		 $options_values_id = $order_stock_by_att->fields['products_options_values_id'];
		 $prod_id = $order_stock_by_att->fields['products_id'];
		 while(!$order_stock_by_att->EOF){
	

		  
		  $attribute_stock_sql = "select pas.stock_id from " .
		  									TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pas, ". TABLE_PRODUCTS_ATTRIBUTES ." pa
											where pa.options_id = '$options_id'
											and pa.options_values_id = '$options_values_id'
											and pa.products_attributes_id = pas.stock_attributes 
											and pas.products_id = '$prod_id' ";
		  $attribute_stock = $db->Execute($attribute_stock_sql);

	      $db->Execute("update ".TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " set 
		  				quantity = quantity + " .$order_stock_by_att->fields['products_quantity'] . "
		  				 where stock_id = '".$attribute_stock->fields['stock_id']."'");
		  $order_stock_by_att->MoveNext();
		}

	 }


    }

    $db->Execute("delete from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");
    $db->Execute("delete from " . TABLE_ORDERS_PRODUCTS . "
                  where orders_id = '" . (int)$order_id . "'");

    $db->Execute("delete from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . "
                  where orders_id = '" . (int)$order_id . "'");

    $db->Execute("delete from " . TABLE_ORDERS_STATUS_HISTORY . "
                  where orders_id = '" . (int)$order_id . "'");

    $db->Execute("delete from " . TABLE_ORDERS_TOTAL . "
                  where orders_id = '" . (int)$order_id . "'");

  }

Ok, now that the function itself has been modified to adapt to what we need, we need to change the necessary calls to allow the new features to be activated.

For me (most of my clients use Super Orders in their zen carts), I modify the /admin/super_orders.php file. Default orders page is the /admin/orders.php file.

Look for the call of php zen_remove_order($oID,$_POST['restock']); and change that to ```php
zen_remove_order($oID, $_POST['restock'],$_POST['restock']);



I hope this helps, I tested it a few times, but not thoroughly.
14 Apr 2008, 4:47 AM
#393
snakehips avatar

snakehips

New Zenner

Join Date:
Mar 2008
Posts:
2
Plugin Contributions:
0

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

I've installed the add-on with no problem, but I kept getting this error:

146 Table '[...]TABLE_PRODUCTS_STOCK' doesn't exist
in:
[select quantity from TABLE_PRODUCTS_STOCK where products_id = '18' AND quantity > 0]

I tried following the instructions given to someone else who had the same problem, but nothing I do on the stocks page seems to change the outcome--I still keep getting the error.

I'm running Zen Cart 1.3.8...

This add-on is exactly what I need, but I can't figure out what's causing this problem. I tried uninstalling everything related to the mod (I'm not sure if I did a clean job, overwrote files, dropped the relevant tables in the database), and the problem persists.

Any advice?

Thanks!

15 Apr 2008, 3:44 AM
#394
ausjohn avatar

ausjohn

New Zenner

Join Date:
Jan 2008
Posts:
12
Plugin Contributions:
0

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

I am having trouble at confirm checkout.
My customers get a message:

1146 Table 'shazzas_clothes08.sc_products_ratio' doesn't exist
in:
[SELECT ratio FROM sc_products_ratio WHERE products_id=116 LIMIT 1]

Orders are sent but stock isn't getting adjusted

Is there anything I can do to fix this as they keep clicking which dup orders

Any help will be appreciated./

Using Zen Cart 3.8

16 Apr 2008, 12:45 PM
#395
ausjohn avatar

ausjohn

New Zenner

Join Date:
Jan 2008
Posts:
12
Plugin Contributions:
0

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

Follow up from my previous message
I think I need to run the SQL file again to fix the tables.
If I do will it detele all my attributes I have already done?
Or is there another workaround?
Thanks in Advanced
John

22 Apr 2008, 6:40 PM
#396
rwoody avatar

rwoody

Totally Zenned

Join Date:
Aug 2004
Location:
Fountain Hills, AZ
Posts:
476
Plugin Contributions:
0

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

I'm not sure if this is possible or if the contrib. - would be relevant, but thought it would not hurt to post and ask - I have a shoe store - I have basically one attribute - size/width - Is it possible that if the distributor tells me let's say size 8M is out of stock but will be back in stock on 5/1/2008 - is it possible to set an date of availability for just that attribute?

22 Apr 2008, 7:54 PM
#397
kuroi avatar

kuroi

Totally Zenned

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

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

snakehips:

I've installed the add-on with no problem, but I kept getting this error:

146 Table '[...]TABLE_PRODUCTS_STOCK' doesn't exist
in:
[select quantity from TABLE_PRODUCTS_STOCK where products_id = '18' AND quantity > 0]

I tried following the instructions given to someone else who had the same problem, but nothing I do on the stocks page seems to change the outcome--I still keep getting the error.

I'm running Zen Cart 1.3.8...

This add-on is exactly what I need, but I can't figure out what's causing this problem. I tried uninstalling everything related to the mod (I'm not sure if I did a clean job, overwrote files, dropped the relevant tables in the database), and the problem persists.Neither this version of Stock by Attributes nor Zen Cart's core code have a products_stock table or define a constant TABLE_PRODUCTS_STOCKS. It looks as though you must have some code floating around from another mod. Though I'm afraid that I don't know which one it might be.

22 Apr 2008, 7:59 PM
#398
kuroi avatar

kuroi

Totally Zenned

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

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

ausjohn:

Follow up from my previous message
I think I need to run the SQL file again to fix the tables.
If I do will it detele all my attributes I have already done?
Or is there another workaround?@ ausjohn

I think we may have covered this in another thread, but just in case ...

products_ratio is not a stock by attributes table, so you must be using another mod, either in place of S by A, or alongside it, and the problem lies with the installation of that mod.

To answer your question above. Were you to re-run the S by A SQL it would not delete your attributes, but would most likely delete any stock records that you have created from those attributes.

22 Apr 2008, 8:01 PM
#399
kuroi avatar

kuroi

Totally Zenned

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

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

rwoody:

I'm not sure if this is possible or if the contrib. - would be relevant, but thought it would not hurt to post and ask - I have a shoe store - I have basically one attribute - size/width - Is it possible that if the distributor tells me let's say size 8M is out of stock but will be back in stock on 5/1/2008 - is it possible to set an date of availability for just that attribute?It's a good idea, but the mod doesn't support it.

22 Apr 2008, 8:33 PM
#400
hgrubb avatar

hgrubb

New Zenner

Join Date:
Mar 2008
Posts:
26
Plugin Contributions:
0

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

snakehips:

I've installed the add-on with no problem, but I kept getting this error:

146 Table '[...]TABLE_PRODUCTS_STOCK' doesn't exist
in:
[select quantity from TABLE_PRODUCTS_STOCK where products_id = '18' AND quantity > 0]!

I am having the same error. If anyone can help, I would appreciate it! I've unistalled and resintalled twice. No luck. Please help, I really need this mod.