Forums / All Other Contributions/Addons / Stock by Attribute for ZC 1.3.9c/d changes to core files

Stock by Attribute for ZC 1.3.9c/d changes to core files

Locked

Views: 1,086

Results 1 to 9 of 9
This thread is locked. New replies are disabled.
23 Jul 2010, 3:04 AM
#1
nholovacs avatar

nholovacs

New Zenner

Join Date:
Jul 2008
Location:
Rochester, NY
Posts:
8
Plugin Contributions:
0

Stock by Attribute for ZC 1.3.9c/d changes to core files

Thanks for reading this. I'm sorry if the answer is posted someplace else, but if it was I was not able to find it.

I have ZC 1.3.9c, upgraded from 1.3.8a via script on a hosted site. Like many others, it is highly customized with changes to many PHP files to allow for add-ons not included in ZC. Not only that, I have made numerous of my own changes to add notations to templates and and messages throughout the ZC code... Needless to say it is a Frankenstein creation at this point.

...but, having said that, please understand that I am not PHP savvy, but I AM technology savvy, so although I was able to make very many changes they are not my own PHP code and my understanding of the PHP structure of the site is very limited.

Stock by Attribute is something I recently released I need to implement more-or-less immediately. The latest release states it works with 1.3.9/1.3.9d, but the included core files would overwrite the files I have made my own changes too... this wouldn't be such a huge deal if the changes I made were only text, but some of the modifications were additional modules (such as one to create orders manually) that required me to make special changes outside of the instructions of the installs so that it worked ... I didn't document everything I did :oops:

Replacing the files outright will simply break the rest of the store. I wanted to do a comparison and make the manual edits, but to me it appears that the core files included are from much older versions of ZC... based on my novice experience and knowledge of PHP code it appears that these files could be missing major changes in my version of ZC... Instead of the core files being from 1.3.9 which would only include the changes to allow the module to work, it is from the original version of the module and has been migrated through the ZC versions...

So it seems that Not only would I have to compare MY changes, but the Changes to 1.3.9 AND the Module and derive the correct lines to remove, add, and leave alone... a daunting task that makes my little head spin.:wacko:

Has anyone determined what the actual lines of code that need to be added or changed in the Core files in order to made this mod work?

Thanks!

24 Jul 2010, 1:54 AM
#2
creinold avatar

creinold

Zen Follower

Join Date:
Sep 2008
Location:
North Highlands, California 95660
Posts:
287
Plugin Contributions:
0

Re: Stock by Attribute for ZC 1.3.9c/d changes to core files

did you look up my stock by attribute, I updated it using 1.3.9D You'll have to use winmerge to adjust changes.

http://www.gotleather.com/Stock_by_Attributes_creinold_files_V4.8.zip

http://www.sidewalkstyles.com Comfort Footwear, Accessories and More.
creinold SBA with Dynamic Drop Downs latest Alpha release: http://www.sidewalkstyles.com/creinold_SBA5.0_alpha_version1.5_for_zencart_V1.5.0.zip

24 Jul 2010, 1:09 PM
#3
nholovacs avatar

nholovacs

New Zenner

Join Date:
Jul 2008
Location:
Rochester, NY
Posts:
8
Plugin Contributions:
0

Re: Stock by Attribute for ZC 1.3.9c/d changes to core files

Thanks! I'll look at it now.

24 Jul 2010, 1:27 PM
#4
nholovacs avatar

nholovacs

New Zenner

Join Date:
Jul 2008
Location:
Rochester, NY
Posts:
8
Plugin Contributions:
0

Re: Stock by Attribute for ZC 1.3.9c/d changes to core files

It looks like this was the major edit in the Orders.PHP (which was my major concern)

// kuroi: SbA
$option_name_array = explode(":", $order->products[$i]['attributes'][$j]['option']);
$option_Name = $option_name_array[0];
// end: sbA
echo '<br /><nobr><small> <i> - ' . $option_Name . ': ' . nl2br($order->products[$i]['attributes'][$j]['value']);

Thank you so much. This version of the Stock-by-attribute is much cleaner and easier for me sift through. I'm going to bet that the rest of the files will also be so I will say thanks now. If I have any other questions I'll come back. Thanks again!

24 Jul 2010, 5:12 PM
#5
nholovacs avatar

nholovacs

New Zenner

Join Date:
Jul 2008
Location:
Rochester, NY
Posts:
8
Plugin Contributions:
0

Re: Stock by Attribute for ZC 1.3.9c/d changes to core files

OK, All worked as expected except...

I have configured products with a two-option selection. When a customer adds a product they must select

-flavor option (1 - 4)
-strength option (a - d)

The problem lies where production option combination for, say, 3b does not exist or has 0 stock. The customer is allowed to select it anyway... which is confusing because the message will appear stating that there is not enough qty on hand... Now I could change the message but that still leaves the customer guessing as to what is in stock... or I could display my stock, but my stock is very low and I would prefer not to advertise this.

I would rather not display a combination of options that have 0 stock or do not exist so the customer cannot select it in the first place. Is this possible to do? :dontgetit

25 Jul 2010, 7:47 PM
#6
creinold avatar

creinold

Zen Follower

Join Date:
Sep 2008
Location:
North Highlands, California 95660
Posts:
287
Plugin Contributions:
0

Re: Stock by Attribute for ZC 1.3.9c/d changes to core files

See if this helps you out:

open /includes/modules/attributes.php and replace this:

$sql = "select    pov.products_options_values_id,
                        pov.products_options_values_name,
                        pa.*
              from      " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov
              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'] . "' " .
                $order_by;

with this:

$sql=	"SELECT  pov.products_options_values_id,
       					 pov.products_options_values_name,
       					 pa.*,
       					 pwas.*
        	    FROM   " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov, " . TABLE_PRODUCTS_ATTRIBUTES . " pa 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    (pwas.quantity > 0 or pwas.quantity IS NULL)
      			and    pa.options_values_id = pov.products_options_values_id
             	and       pov.language_id = '" . (int)$_SESSION['languages_id'] . "' " .
				$order_by;

http://www.sidewalkstyles.com Comfort Footwear, Accessories and More.
creinold SBA with Dynamic Drop Downs latest Alpha release: http://www.sidewalkstyles.com/creinold_SBA5.0_alpha_version1.5_for_zencart_V1.5.0.zip

25 Jul 2010, 7:49 PM
#7
creinold avatar

creinold

Zen Follower

Join Date:
Sep 2008
Location:
North Highlands, California 95660
Posts:
287
Plugin Contributions:
0

Re: Stock by Attribute for ZC 1.3.9c/d changes to core files

Or you may want to install the Dynamic Drop Downs for SBA mod, it has an option in it to: Prevent Adding Out of Stock to Cart

http://www.sidewalkstyles.com Comfort Footwear, Accessories and More.
creinold SBA with Dynamic Drop Downs latest Alpha release: http://www.sidewalkstyles.com/creinold_SBA5.0_alpha_version1.5_for_zencart_V1.5.0.zip

26 Jul 2010, 12:30 AM
#8
nholovacs avatar

nholovacs

New Zenner

Join Date:
Jul 2008
Location:
Rochester, NY
Posts:
8
Plugin Contributions:
0

Re: Stock by Attribute for ZC 1.3.9c/d changes to core files

creinold,

Thank you. I will try it out and let you know. My novice understanding of PHP and SQL tell me that this looks like it if I run out of stock on an attribute item it will not include it in the selectable items. I don't think I'll be able to put this mod tonight, but I will let you know.

Thanks again!

1 Sep 2010, 11:08 PM
#9
nholovacs avatar

nholovacs

New Zenner

Join Date:
Jul 2008
Location:
Rochester, NY
Posts:
8
Plugin Contributions:
0

Re: Stock by Attribute for ZC 1.3.9c/d changes to core files

Has it been this long since I last posted? I'm so sorry. As I expected, your code worked perfectly. Thank you so much!