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

Results 1,861 to 1,880 of 3,609
15 Apr 2014, 12:51 AM
#1861
potteryhouse avatar

potteryhouse

Zen Follower

Join Date:
Jun 2012
Location:
Florida
Posts:
123
Plugin Contributions:
0

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

Christian_Wagner:

Unfortunately it tells me the product is out of stock :(. That's how we used to do it and when we upgraded to the new version it messed it up.

I must ask, are you using Zencart 1.5.1 and upgrading from mod version 1.4.x ??
If so, did you run the installation script "admin/stock_by_attr_install.php", (and test on a test site first?).
Are you using mod version 1.5.3, you may need to follow the small correction here to the install script:

http://www.zen-cart.com/showthread.php?47180-Stock-by-Attribute-v4-0-addon-for-v1-3-5-1-3-9&p=1242901#post1242901

The script adds some configuration settings to the "Configuration -> Stock" page in admin.
See instructions "Instructions/htm/notes.html" for some additional notes.

15 Apr 2014, 5:31 PM
#1862
christian_wagner avatar

christian_wagner

New Zenner

Join Date:
May 2013
Location:
Long Branch, NJ
Posts:
49
Plugin Contributions:
0

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

potteryhouse:

I must ask, are you using Zencart 1.5.1 and upgrading from mod version 1.4.x ??
If so, did you run the installation script "admin/stock_by_attr_install.php", (and test on a test site first?).
Are you using mod version 1.5.3, you may need to follow the small correction here to the install script:

http://www.zen-cart.com/showthread.php?47180-Stock-by-Attribute-v4-0-addon-for-v1-3-5-1-3-9&p=1242901#post1242901

The script adds some configuration settings to the "Configuration -> Stock" page in admin.
See instructions "Instructions/htm/notes.html" for some additional notes.

Currently working on 1.5.2. Not sure why but I'm having trouble installing 1.5.3 even though I installed 1.5.2. :(

15 Apr 2014, 8:58 PM
#1863
potteryhouse avatar

potteryhouse

Zen Follower

Join Date:
Jun 2012
Location:
Florida
Posts:
123
Plugin Contributions:
0

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

Christian_Wagner:

Currently working on 1.5.2. Not sure why but I'm having trouble installing 1.5.3 even though I installed 1.5.2. :(
What issue (error messgaes) are you having with the installation of version1.5.3 mod?

Also, note that version 1.5.3 supports the multiple attribute combination you want, 1.5.2 did not.
The install script has a file check option to see if all the files are in the correct place, you might try running that to see if it helps narrow the install problem down.

18 Apr 2014, 9:47 PM
#1864
outbreak avatar

outbreak

New Zenner

Join Date:
Oct 2009
Posts:
35
Plugin Contributions:
0

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

Quick question, and I apologize if it's already been asked. I would like to remove the quantity remaining, how would I go about that?

Thank you!

30 Apr 2014, 7:41 PM
#1865
christian_wagner avatar

christian_wagner

New Zenner

Join Date:
May 2013
Location:
Long Branch, NJ
Posts:
49
Plugin Contributions:
0

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

potteryhouse:

What issue (error messgaes) are you having with the installation of version1.5.3 mod?

Also, note that version 1.5.3 supports the multiple attribute combination you want, 1.5.2 did not.
The install script has a file check option to see if all the files are in the correct place, you might try running that to see if it helps narrow the install problem down.

Sorry for the late reply. Been trying to make it work. Sadly, I haven't. After merging the files in Araxis and installing correctly, it makes the store non-functional. Just a blank white screen. Not sure what the issue is.

30 Apr 2014, 8:20 PM
#1866
potteryhouse avatar

potteryhouse

Zen Follower

Join Date:
Jun 2012
Location:
Florida
Posts:
123
Plugin Contributions:
0

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

Christian_Wagner:

Sorry for the late reply. Been trying to make it work. Sadly, I haven't. After merging the files in Araxis and installing correctly, it makes the store non-functional. Just a blank white screen. Not sure what the issue is.
I am willing have a look at the files you modified it you would like.
Just zip the modified files up and send me an FTP link, there is a chance I might find your problem...
Please Do Not include private information like database name, passwords, or secret admin folder name, sanitize any of these that may be in the files.

30 Apr 2014, 8:24 PM
#1867
potteryhouse avatar

potteryhouse

Zen Follower

Join Date:
Jun 2012
Location:
Florida
Posts:
123
Plugin Contributions:
0

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

outbreak:

Quick question, and I apologize if it's already been asked. I would like to remove the quantity remaining, how would I go about that? Thank you!
Hi, I read your question, but am not clear on what you need, do you want to zero out the values in the database table for these attributes, or is this text on the web page you want changed?

30 Apr 2014, 8:27 PM
#1868
christian_wagner avatar

christian_wagner

New Zenner

Join Date:
May 2013
Location:
Long Branch, NJ
Posts:
49
Plugin Contributions:
0

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

potteryhouse:

I am willing have a look at the files you modified it you would like.
Just zip the modified files up and send me an FTP link, there is a chance I might find your problem...
Please Do Not include private information like database name, passwords, or secret admin folder name, sanitize any of these that may be in the files.

Sent. Thanks!

30 Apr 2014, 10:26 PM
#1869
potteryhouse avatar

potteryhouse

Zen Follower

Join Date:
Jun 2012
Location:
Florida
Posts:
123
Plugin Contributions:
0

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

Christian_Wagner:

Sent. Thanks!
Based on the files you sent, it looks like you forgot to update the attributes.php file.
This file was moved to a template override folder in version 1.5.3, but if you just replace the one in \includes\modules with the new one things should get better.
\includes\modules\YOUR_TEMPLATE\attributes.php
The version under your \includes\modules folder is no longer any good, will not work with the code updates.

11 May 2014, 1:09 PM
#1870
tony_kast avatar

tony_kast

New Zenner

Join Date:
Oct 2013
Location:
Chatham, Medway, United Kingdom
Posts:
2
Plugin Contributions:
0

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

Hi Can anyone help, when i first installed SBA i had a minimum delivery section which i deleted, now my site keeps going wrong, when i add a attribute i get a error message on checkout and shipping estimate, if i dont add one it works fine does anyone know of an easy fix ive tried updating the database and trying again but it does the same everytime i reinstall it and now im not getting the delivery option

12 May 2014, 1:55 AM
#1871
potteryhouse avatar

potteryhouse

Zen Follower

Join Date:
Jun 2012
Location:
Florida
Posts:
123
Plugin Contributions:
0

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

Tony Kast:

Hi Can anyone help, when i first installed SBA i had a minimum delivery section which i deleted, now my site keeps going wrong, when i add a attribute i get a error message on checkout and shipping estimate, if i dont add one it works fine does anyone know of an easy fix ive tried updating the database and trying again but it does the same everytime i reinstall it and now im not getting the delivery option
Need more information before being able to venture a guess.
What version of SBA did you install? As there are several versions of this branch of the mod and there are also other branches that are supported in other threads.

In what file (and what line number) did you delete the "minimum delivery section"?
Also need to know which version of Zen Cart you store is using?

12 May 2014, 8:45 PM
#1872
tony_kast avatar

tony_kast

New Zenner

Join Date:
Oct 2013
Location:
Chatham, Medway, United Kingdom
Posts:
2
Plugin Contributions:
0

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

Hi Thanks for your reply, i unistalled the module and reinstalled it a few times and i managed to get the minimum delivery option back, im now having another problem though all of my items are showing out of stock, regardless of how many i have they all say the same amount and then out of stock when i test a check out, im using Stock By Attribute (SBA) installation script SBA Version 1.5.3 for Zen Cart Version 1.5.1 By POTTERY HOUSE my shop is at sharerescue.co.uk/shop

thanks for any help you can offer

13 May 2014, 2:18 PM
#1873
potteryhouse avatar

potteryhouse

Zen Follower

Join Date:
Jun 2012
Location:
Florida
Posts:
123
Plugin Contributions:
0

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

Tony Kast:

Hi Thanks for your reply, i unistalled the module and reinstalled it a few times and i managed to get the minimum delivery option back, im now having another problem though all of my items are showing out of stock, regardless of how many i have they all say the same amount and then out of stock when i test a check out, im using Stock By Attribute (SBA) installation script SBA Version 1.5.3 for Zen Cart Version 1.5.1 By POTTERY HOUSE my shop is at sharerescue.co.uk/shop

thanks for any help you can offer

The issue looks like a simple configuration problem.
The instructions included with the mod should help you, if you have suggestions to make the instructions clearer or otherwise improved please send to me as I am currently working on a new version that improves the selection list and rotates the image on selection change.

Basically, you should do the following.

  1. in admin, goto 'configuration -> stock' and make changes as you need to make you page look as you want.
  2. in admin, goto 'catalog -> Product with Attribute stock (aka SBA)' and add stock and combinations that you need for each product.

The instruction with the mod should help with understanding what each option does.
Note that each time you run the SBA installation script it resets all options to a default state, thus if you previously made these changes but than ran the installation script again, everything is reset.

19 May 2014, 3:06 PM
#1874
shk avatar

shk

New Zenner

Join Date:
Oct 2006
Posts:
62
Plugin Contributions:
0

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

Zen Cart v1.5.1, SBA 1.5.3. Clean install with only the SBA files in a new template.

I have "SBA Display Custom ID" = true.

I created an product with 2 attributes, size XL and XXL, and gave them each a custom ID (11111111111111 and 22222222222222).
When I add both XL and XXL to the shopping cart, it looks like this:

test
item # 11111111111111
Size - XL
test
item # 22222222222222
Size - XXL

However, once I get to checkout_comfirmation, it now looks like this: (testtest123 is the product model)

test
item # 11111111111111
Size - XL
test
item # testtest123
Size - XXL

And so it stays once I completed the order. In Customers/orders, and everywhere else (invoice, etc).
It seems that the custom ID is replaced by the product model for all but the first attribute.

What could be causing this? How can I fix it?

19 May 2014, 5:33 PM
#1875
shk avatar

shk

New Zenner

Join Date:
Oct 2006
Posts:
62
Plugin Contributions:
0

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

It seems the error is introduced in this section: (/includes/functions/extra_functions/products_with_attributes.php line 98)

                  if(sizeof($attributes) > 1){
                      $first_search = 'where options_values_id in ("'.implode('","',$attributes).'")';
                  } else {
                      //even though there is only one attribute, it is still in an array and must be retrieved
                      foreach($attributes as $attribute){
                          $first_search = ' where options_values_id="'.$attribute.' "';
                      }
                  }

Removing the if/else and leaving only the second option solves the custom ID issue.
Obviously you could also raise the number in the if statement so that it is never triggered.
This however seems like a flimsy solution at best.

The issue remains on the other pages though. (orders, invoice etc)

19 May 2014, 6:12 PM
#1876
shk avatar

shk

New Zenner

Join Date:
Oct 2006
Posts:
62
Plugin Contributions:
0

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

Altering this in the same way solves the customer ID issue on the other pages.. (/admin/includes/classes/products_with_attributes_stock.php line 513)

                  if(sizeof($attributes) > 1){
                      $first_search = 'where options_values_id in ("'.implode('","',$attributes).'")';
                  } else {
                      //even though there is only one attribute, it is still in an array and must be retrieved
                      foreach($attributes as $attribute){
                          $first_search = ' where options_values_id="'.$attribute.' "';
                      }
                  }

Im not sure I would risk using this on my live site, but it seems to work alright on my test sites.

20 May 2014, 9:21 AM
#1877
shk avatar

shk

New Zenner

Join Date:
Oct 2006
Posts:
62
Plugin Contributions:
0

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

For non SBA-products, the product model replaces the custom ID. This works fine in the cart, but yet again, not in the checkout nor order/invoice/etc.
Reading the code, it seems like this was supposed to work. (/includes/templates/YOUR_TEMPLATE/templates/tpl_checkout_confirmation_default.php line 165)

<?php
    // START "Stock by Attributes"
    $customid = null;
    $tmpCheck = null;
    if( STOCK_SBA_DISPLAY_CUSTOMID == 'true'){
        if ( (isset($order->products[$i]['attributes'])) &&  (sizeof($order->products[$i]['attributes']) > 0) ) {
            //create array for use in zen_get_customid
            for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) {
                $attributes[] = $order->products[$i]['attributes'][$j]['value_id'];//value_id option_id
            }
            $customid = '(';
            //get custom ID
            for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) {
                if( $tmpCheck != zen_get_customid($order->products[$i]['id'],$attributes) ){
                    $tmpCheck = zen_get_customid($order->products[$i]['id'],$attributes);
                    $customid .= ' ' . zen_get_customid($order->products[$i]['id'],$attributes) . ' ';
                }
            }
            $customid .= ')';
        }
        elseif(isset($order->products[$i]['products_model'])){
            $customid = '(' . $order->products[$i]['products_model'] . ')';
        }
    }
    echo $customid;
      // END "Stock by Attributes"
?>

That elseif is suposed to grab the products_model and use it in place of the custom ID, but it does not work.
At line 158, several calls in the non-SBA code omits the products_ prefix, so I did the same. And that worked.

<?php // now loop thru all products to display quantity and price ?>
<?php for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { ?>
        <tr class="<?php echo $order->products[$i]['rowClass']; ?>">
          <td  class="cartQuantity"><?php echo $order->products[$i]['qty']; ?> x</td>
          <td class="cartProductDisplay"><?php echo $order->products[$i]['name']; ?>
          <?php  echo $stock_check[$i]; ?>

Now, if I alter** /admin/orders.php** to display custom ID instead of product model, there will be a consistent display throughout the catalog and admin.
At every step, each product or product attribute, representing actual products in my store, are listed with their unique EAN.
This may not be how everyone uses SBA, but it certainly is how I want it to work.

At any rate.. are these alterations I've made fixes to flaws in the code, or should I look elsewhere for the actual cause of my problem?

Thanks for any help!

20 May 2014, 12:11 PM
#1878
potteryhouse avatar

potteryhouse

Zen Follower

Join Date:
Jun 2012
Location:
Florida
Posts:
123
Plugin Contributions:
0

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

SHK:

For non SBA-products, the product model replaces the custom ID. This works fine in the cart, but yet again, not in the checkout nor order/invoice/etc.
Reading the code, it seems like this was supposed to work. (/includes/templates/YOUR_TEMPLATE/templates/tpl_checkout_confirmation_default.php line 165)

<?php // START "Stock by Attributes" $customid = null; $tmpCheck = null; if( STOCK_SBA_DISPLAY_CUSTOMID == 'true'){ if ( (isset($order->products[$i]['attributes'])) && (sizeof($order->products[$i]['attributes']) > 0) ) { //create array for use in zen_get_customid for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) { $attributes[] = $order->products[$i]['attributes'][$j]['value_id'];//value_id option_id } $customid = '('; //get custom ID for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) { if( $tmpCheck != zen_get_customid($order->products[$i]['id'],$attributes) ){ $tmpCheck = zen_get_customid($order->products[$i]['id'],$attributes); $customid .= ' ' . zen_get_customid($order->products[$i]['id'],$attributes) . ' '; } } $customid .= ')'; } elseif(isset($order->products[$i]['products_model'])){ $customid = '(' . $order->products[$i]['products_model'] . ')'; } } echo $customid; // END "Stock by Attributes" ?>
> That **elseif** is suposed to grab the products_model and use it in place of the custom ID, but it does not work.
> At line 158, several calls in the non-SBA code omits the products_ prefix, so I did the same. And that worked.
> ```php
<?php // now loop thru all products to display quantity and price ?>
<?php for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { ?>
        <tr class="<?php echo $order->products[$i]['rowClass']; ?>">
          <td  class="cartQuantity"><?php echo $order->products[$i]['qty']; ?> x</td>
          <td class="cartProductDisplay"><?php echo $order->products[$i]['name']; ?>
          <?php  echo $stock_check[$i]; ?>

Now, if I alter** /admin/orders.php** to display custom ID instead of product model, there will be a consistent display throughout the catalog and admin.
At every step, each product or product attribute, representing actual products in my store, are listed with their unique EAN.
This may not be how everyone uses SBA, but it certainly is how I want it to work.

At any rate.. are these alterations I've made fixes to flaws in the code, or should I look elsewhere for the actual cause of my problem?

Thanks for any help!

I plan to look at this soon (within a week I hope), to verify your findings, and provide an update. Thank you for the information (and code samples), there are always scenarios we overlook or do not see when working and testing code updates, this testing and feedback you and others provide is very important. I will post what I find, and a package for others to test prior to adding to plugins.

Brent

21 May 2014, 1:49 PM
#1879
leha avatar

leha

New Zenner

Join Date:
May 2014
Location:
Suomi
Posts:
1
Plugin Contributions:
0

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

Hi!
I have problems with Custom ID too
a made fresh install on test server. zencart 1.5.1 and last stock by attributes, nothing else

  1. I have only one product with 3 colors and 3 sizes, and Custom IDs
    Attachment 14091

  2. Lets add them to the cart, we see that custom id is showing correctly
    Attachment 14092

  3. Let's go to checkout page - Only One custom ID is showing, others are blank ( )
    Attachment 14093

  4. And now we confirm order and let's go to admin panel to watch new order
    Attachment 14094

Only one Custom ID is showing, second custom id is wrong :-// other are blank

I need a solution for this. Thank you

28 May 2014, 12:48 PM
#1880
amitvkaria avatar

amitvkaria

New Zenner

Join Date:
Feb 2012
Posts:
7
Plugin Contributions:
0

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

I installed this and everything seems to be working fine but am getting a blank page when I checkout - the file link on URL is -

http://importedhai.com/index.php?main_page=checkout_shipping

Can you please help what file am I missing out - Thanks