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

Results 1,261 to 1,280 of 3,609
17 Aug 2011, 17:27
#1261
shinmai avatar

shinmai

New Zenner

Join Date:
Aug 2009
Location:
Canada
Posts:
42
Plugin Contributions:
0

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

Oh, and warning displays for the product WITH attribute if I place order HIGHER than TOTAL NUMBER of the product available (say Product A has 1 Small, 2 Medium, 3 Large = 6 TOTAL NUMBER) :wacko:

Please help!!

17 Aug 2011, 22:30
#1262
webstar59 avatar

webstar59

New Zenner

Join Date:
Jun 2011
Location:
California
Posts:
63
Plugin Contributions:
0

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

ZEN 1.3.9h stock_by_attributes_1.4.13

I installed this mod on a test store and it works fine.
Then i installed on a live store and now i can't login to admin panel. Also this live store has the MOD ADMIN PROFILE installed.
This has to be the problem.

Has anybody had the some problem?
and how did you fix it.

In the mean time i think ill install admin profiles on my test site and see if it crashs it

17 Aug 2011, 23:23
#1263
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

If you think it's an Admin Profiles problem, then the support thread for that mod would be a more appropriate place to post.

Seems unlikely though, as Admin Profiles doesn't get involved until after you've logged in. More likely (especially if AP was working before) would be that one or more of the Stock by Attributes files has ended up in the wrong place, has the wrong permissions for your server, or has gotten corrupted preventing pages from launching properly.

That's a bit speculative though, as you haven't really explained in what way you're being prevented from logging in, so there's not a whole lot to go with here.

17 Aug 2011, 23:35
#1264
webstar59 avatar

webstar59

New Zenner

Join Date:
Jun 2011
Location:
California
Posts:
63
Plugin Contributions:
0

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

What i mean by not loging in the page can't be found when trying to login to admin page

17 Aug 2011, 23:40
#1265
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

Very difficult to see how either of the mods named could cause this, but let's try. What's the URL in the browser bar when you get the page not found message?

18 Aug 2011, 02:06
#1266
webstar59 avatar

webstar59

New Zenner

Join Date:
Jun 2011
Location:
California
Posts:
63
Plugin Contributions:
0

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

kuroi:

Very difficult to see how either of the mods named could cause this, but let's try. What's the URL in the browser bar when you get the page not found message?

Webstar59
The url is to the admin folder domain/adminfolder/login.php
or domain/adminfolder/index.php or just domain/adminfolder/
can't be found. Im going to do some test on my test store first
and if it works then may I did put a file in the wrong place. your MOD works fine on my test site now but will see what happens when i install admin profile MOD I know this mod has nothing to do with this thread just thought somebody here had the same problem.

18 Aug 2011, 02:50
#1267
webstar59 avatar

webstar59

New Zenner

Join Date:
Jun 2011
Location:
California
Posts:
63
Plugin Contributions:
0

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

webstar59:

Webstar59
The url is to the admin folder domain/adminfolder/login.php
or domain/adminfolder/index.php or just domain/adminfolder/
can't be found. Im going to do some test on my test store first
and if it works then may I did put a file in the wrong place. your MOD works fine on my test site now but will see what happens when i install admin profile MOD I know this mod has nothing to do with this thread just thought somebody here had the same problem.

OK i just installed admin profiles mod and now i have the same problem. So the 2 mods don't like to run together. I go to the admin profile mod thread and see what i can find. If anything Ill dump the admin mod because we need stock by attributes

18 Aug 2011, 19:05
#1268
webstar59 avatar

webstar59

New Zenner

Join Date:
Jun 2011
Location:
California
Posts:
63
Plugin Contributions:
0

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

Clean install Zen-cart v1.3.9h
stock_by_attributes_1-4-13

I have the same problem as the user hostilerecords on page 14
Their post was:

I have installed it and then set up stock values for each attribute, however you can still checkout with variations which are out of stock, for example;

Army Camo Jacket
10 Total
5 Medium
5 Large

I can't checkout with more than 10, thats fine.
But I can checkout with 6 Medium.

How can I Fix this?

Stock config:
Check stock level- True
Subtract stock- True
Allow Checkout- False
Show stock when low- True

Webstar59 IS there a fix for this?

18 Aug 2011, 23:41
#1269
pablo avatar

pablo

New Zenner

Join Date:
Jun 2011
Posts:
91
Plugin Contributions:
0

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

Update the code in your header_php.php file with the fix on page 114 of this thread.:yes:

19 Aug 2011, 08:11
#1270
webstar59 avatar

webstar59

New Zenner

Join Date:
Jun 2011
Location:
California
Posts:
63
Plugin Contributions:
0

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

Pablo:

Update the code in your header_php.php file with the fix on page 114 of this thread.:yes:

I found this tip on some blog i forgot where.
This fixed my problem. Credit gos to the bloger.
Zen Cart - stock by attributes plugin bug
I've found a couple of bugs with this, otherwise excellent, module:

  1. If you are not logged in Zen Cart will allow you to progress to the login page even if you have ignored the 'delete out-of-stock' products message on the shopping cart page. This may not seem a big deal, as you can't progress further, but from a user experience perspective it's definitely not ideal.
  2. If there is an out-of-stock product in your cart, all subsequent products you add will also be flagged as out-of-stock whether or not this is true.

Fortunately both issues were easy to fix with a little digging.

Issue 1 involves a modification to /includes/modules/pages/checkout_shipping/header_php.php.

Simply move the block of code under
// Stock Check
until it is above the section beginning with

// if the customer is not logged on, redirect them to the login page

This will force the page to check for stock before redirecting to the login page.

Issue 2 needs a small addition to
/includes/modules/pages/shopping_cart/header_php.php

Look for this section around line 59:

$flagAnyOutOfStock = false;


$products = $_SESSION['cart']->get_products();
for ($i=0, $n=sizeof($products); $i$n; $i++) {
if (($i/2) == floor($i/2)) {

Change it to read:

$products = $_SESSION['cart']->get_products();
for ($i=0, $n=sizeof($products); $i$n; $i++) {
$flagStockCheck = false;
if (($i/2) == floor($i/2)) {
```This will force a reset of the flag for each iteration of the loop which builds the....
22 Aug 2011, 15:36
#1271
cheekycockney avatar

cheekycockney

Zen Follower

Join Date:
Apr 2006
Posts:
172
Plugin Contributions:
0

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

I am still struggling with the problem below, I'm thinking maybe this code is dependant on specific stock settings in the admin? I say this because of the line if ( (STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') ...

CheekyCockney:

Hi. I have a problem which I believe may have come up before, my 'out of stock items' are able to be checked out using the PayPal Quickpay button. The normal 'Pay button' correctly loops back to the cart with an Out Of Stock message. This is only the case when my products have attributes, with all other products both buttons loop back to the cart.

On page 70 of this thread i found this info but it doesn't seem to have made a difference.


Similar patch for making Pay Pal Express not allow checkout with not enough stock according to SBA.

Edit ipn_main_handler.php and find:

Code:
require('includes/application_top.php');

Just below that, add the following code:

Code:

// Stock Check - kiddo hack
if ( (STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') ) {
$products = $_SESSION['cart']->get_products();
for ($i=0, $n=sizeof($products); $i<$n; $i++) {

  unset($attributes);
  if(is_array($products[$i]['attributes'])){
  	$attributes = $products[$i]['attributes'];
  	} else {
  		$attributes = '';
  	}


    if (zen_check_stock($products[$i]['id'], $products[$i]['quantity'],$attributes)) {
	  zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
	  break;
  }
}

}

This will not make the yellow button un-active, but will send the customer back to the shopping cart so they can change the cart contents so no out of stock items.


Any help would be appreciated, thanks in advance!

24 Aug 2011, 17:19
#1272
cheekycockney avatar

cheekycockney

Zen Follower

Join Date:
Apr 2006
Posts:
172
Plugin Contributions:
0

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

Sorry to bump but I really need some advice with the problem above, I can't go live until it's fixed and I'm completely stumped. :(

24 Aug 2011, 18:46
#1273
webstar59 avatar

webstar59

New Zenner

Join Date:
Jun 2011
Location:
California
Posts:
63
Plugin Contributions:
0

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

CheekyCockney:

Sorry to bump but I really need some advice with the problem above, I can't go live until it's fixed and I'm completely stumped. :(

Turn off the paypal button from your shopping cart page and only have in on the checkout page. Also mod the script as in the tip i posted

25 Aug 2011, 12:10
#1274
cheekycockney avatar

cheekycockney

Zen Follower

Join Date:
Apr 2006
Posts:
172
Plugin Contributions:
0

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

Hi Webstar, thanks a lot for the advice, I really appreciate it. Removing the button is not really an option, the site is very much geared towards quickpay.

I have tried the first mod in your post above (1272) - it's not exactly the problem I was having but hey, worth a go I thought. Now last night I'm 100% sure my problem was as described above, 'checkout' looped back correctly, 'quick pay' incorrectly proceeds to PayPal. I tried your mod and noticed that then neither button looped back: both proceeded to checkout. So I reverted back to my original version... but (very) strangely both buttons still checkout instead of looping! I'm well aware that this is impossible if I simply changed the code and then changed it back... but that's really what it seems like! Not sure what I've done here.

So currently both my buttons proceed to checkout when an out of stock product with attributes is in the basket. I've also just noticed that this is only the case when there is 1, 2 or 3 products. If I increase the amount to 4 or more the buttons begin to work as they should and both correctly loop back to the basket.

Weird. I'm going crazy here. Thanks again.

27 Aug 2011, 10:29
#1275
cheekycockney avatar

cheekycockney

Zen Follower

Join Date:
Apr 2006
Posts:
172
Plugin Contributions:
0

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

In an act of desperation I have turned off QuickPay but the Checkout button still allows me to proceed. Could somebody please do me a favour and list the files that are involved in this process? I plan to replace what I'm using with original versions and see what happens.

27 Aug 2011, 11:05
#1276
cheekycockney avatar

cheekycockney

Zen Follower

Join Date:
Apr 2006
Posts:
172
Plugin Contributions:
0

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

Thinking about it my cart is definitely checking the stock and it is able to loop back to the cart... as it does this fine when there are 4 or more out of stock items... i'm thinking maybe the code that specifically tests the numbers has got messed up somehow? Eg, if amount is basket > amount in stock or something. Or whatever it is the cart does. Where can I find this code?

28 Aug 2011, 11:34
#1277
cheekycockney avatar

cheekycockney

Zen Follower

Join Date:
Apr 2006
Posts:
172
Plugin Contributions:
0

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

Another update, it has become clear my problem above is caused by stock numbers for all attributes on a product being added together somewhere causing my stock levels to be wrongly represented in the cart.

Eg: On a product I have 3x small 2x medium and no large. If I add a large to the cart it is correctly flagged as out of stock but both buttons allow checkout. If I increase the amount in the cart to 5 (3small+2medium) I can still checkout. If I increase to 6, both Checkout and QuickPay both behave correctly and loop back. The Out Of Stock warning always shows correctly, the issue is only on the buttons.

This is also the case when adding in-stock items, I can chackout 5 or less of any size/attribute becuase of their total number.

Hopefully this clears things up a a little?

28 Aug 2011, 12:02
#1278
soxophoneplayer avatar

soxophoneplayer

Totally Zenned

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

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

CheekyCockney wrote:

Eg: On a product I have 3x small 2x medium and no large. If I add a large to the cart it is correctly flagged as out of stock but both buttons allow checkout. If I increase the amount in the cart to 5 (3small+2medium) I can still checkout. If I increase to 6, both Checkout and QuickPay both behave correctly and loop back. The Out Of Stock warning always shows correctly, the issue is only on the buttons.

Not sure what version you're using. I use 1.4.9 Ajax with no troubles.

Just wondering if your admin settings are muddying your waters:

Do you have admin/configuration/stock/allow checkout set to 'false' disallow checkout with insufficient stock.

And/or if:
In your product description(s) you have 'Minimum Purchase' set to greater than 1.

I apologize if I'm stating obvious.

28 Aug 2011, 13:02
#1279
cheekycockney avatar

cheekycockney

Zen Follower

Join Date:
Apr 2006
Posts:
172
Plugin Contributions:
0

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

No need to apologise, thanks for the input. The sollution could well be obvious! But yes, stock settings are as they should be and minumum purchase (Product Qty minimum I think we're talking about?) is set as 1. My cart is 1.3.9, stock by atts 1.4.12 with a couple of bug fixes as stated above.

Looking at my product description in the admin I can see it adds all the attribute stock levels together and labels it 'Product Quantity'. I guess this is normal and sort of makes sense but I beleieve my cart is testing this stock level and not the attribute levels. Maybe one of my bug fixes or something reverted this code back to the pre-attribute mod version?

Thanks again.

28 Aug 2011, 21:14
#1280
webstar59 avatar

webstar59

New Zenner

Join Date:
Jun 2011
Location:
California
Posts:
63
Plugin Contributions:
0

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

zen 1.3.9h
Stock By Attributes - Current New Version

My stock by attributes works A OK.
This post is about attribute image in cart.
I only have one mod SBA thats why im posting here.

I added some script to the shoppin_cart class file:

includes/classes/mytemplate/shopping_cart.php at line 1193.

//webstar mod here
// support attribute images webstar
        if (isset($this->contents[$products_id]['attributes'])) {
          foreach ($this->contents[$products_id]['attributes'] as $options_id => $options_values_id) {
            // get the attributes image using the options_id and options_values_id
            $attributes_image = $db->Execute("SELECT attributes_image
                                              FROM " . TABLE_PRODUCTS_ATTRIBUTES . "
                                              WHERE products_id = " . (int)$products_id . "
                                              AND options_id = " . $options_id . "
                                              AND options_values_id = " . $options_values_id . "
                                              LIMIT 1;");
            if ($attributes_image->RecordCount() > 0 && $attributes_image->fields['attributes_image'] != '') {
              $products->fields['products_image'] = $attributes_image->fields['attributes_image'];
              break;
            }
          }
        }
//end support attribute images webstar

It works fine on my test store that has no mods. On my live
store that has Stock By Attributes installed it won't work.

I was woundering if maybe Stock By Attributes is over riding
my script some how. Anybody have any ideas?

I found the script from a blog;
How to display attribute images on the Zen Cart shopping cart page http://www.numinix.com/blog/2011/05/19/how-to-display-attribute-images-on-the-zen-cart-shopping-cart-page/