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

Results 941 to 960 of 3,609
27 Oct 2010, 7:03 AM
#941
creinold avatar

creinold

Zen Follower

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

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

Dr byte. Sorry as I didn't mean to offend you. He'll I didn't even know you read ever one of my post. LOL I feel honored. ;) maybei am using the wrong word when I say flaw. Which I have seen many others use similar words to explain the issue.

The issue I am referring to is that people are able to check out even when not selecting an attribute. IE size color etc., just hit the add to cart button and proceed to checkout. I installed a fresh cart with no mods at all and can do this. Now there clever work arounds using an attrribute and required selector to prevent checking out without making a selection as I point out those post without having to retype something someone already has.

Now in my opinion I think at default you shouldn't be allowed to checkout without an attribute selected. I am sure zen cart has it's reason for it.

I tried to come up with a mod to prevent this but couldn't quite figure out all the attribute code make it work. Using the solution kurio been helping everyone out with works for me and hopefully others.

Now to come up with a diffrent word to use... It's a zen thing... ;)

27 Oct 2010, 7:06 AM
#942
creinold avatar

creinold

Zen Follower

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

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

Aszu. I am hoping to have a 1.3.9G version out this week. Scratch that have a version 1.3.9H out this week. LOL

27 Oct 2010, 7:26 AM
#943
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

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

creinold:

Dr byte. Sorry as I didn't mean to offend you. He'll I didn't even know you read ever one of my post. LOL I feel honored. ;)Not offended. Just puzzled. And concerned that you're pointing people to a thread that has too many different topics in it to actually be giving an answer to their specific question.
creinold:

The issue I am referring to is that people are able to check out even when not selecting an attribute. IE size color etc., just hit the add to cart button and proceed to checkout. I installed a fresh cart with no mods at all and can do this.That's specifically by design. There are many legitimate cases for having all attributes be entirely optional. In that case it would be wrong to force attribute selection.
creinold:

Now there clever work arounds using an attrribute and required selector to prevent checking out without making a selection
Exactly. It's very easy to configure exactly what you need if you require certain attributes to be chosen: simply create an option value such as "Please select" and make it "default" and "display-only". This will force them to choose any of the other non-display-only options in order to complete checkout.

27 Oct 2010, 3:08 PM
#944
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

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

creinold:

You sure its not this flaw: http://www.zen-cart.com/forum/showthread.php?t=40664

Nah, I was talking about the ability to check out when there isn't any stock to buy. My memory is that the attribute dropped from the list when the attribute stock amounts dropped to 0. This was several years back.

27 Oct 2010, 3:59 PM
#945
dvdtitan avatar

dvdtitan

New Zenner

Join Date:
Apr 2007
Posts:
87
Plugin Contributions:
0

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

I have just posetd in the ugrade forum regarding an upgrade to 1.39h and the effect i found it had on SBA.

Here's my post from that thread:

So i have just upgraded one of my sites.

It seems to have gone smoothly bar a couple of files.

Files for me which were affected were general.php (i had overwritten on 1.39g but not sure which add on had over written it - Winmerge didn't help either as the two files are so different) but everything seems to be working ok.

Main issue is stock by attributes and in particular the following two files:

  • /includes/modules/pages/checkout_shipping/header_php.php
  • /includes/modules/pages/shopping_cart/header_php.php

I have winmerged the header_php.php file in checkout_shipping succesfully it's the header file in the shopping_cart folder that i am struggling to merge succesfully.

With the merged file i have used no out of stock notification is showing next to an unavailable product in the cart on the customer side.

Any one else using SBA and had the same issue and resolved it?

27 Oct 2010, 4:17 PM
#946
creinold avatar

creinold

Zen Follower

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

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

Try go to Admin - Configuration - Stock and change:

Allow Checkout to False

27 Oct 2010, 4:26 PM
#947
creinold avatar

creinold

Zen Follower

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

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

DVDTitan:

I have just posetd in the ugrade forum regarding an upgrade to 1.39h and the effect i found it had on SBA.

Here's my post from that thread:

WHat and whos version are you using. I think my last version fixed this but it was for 1.3.9E

27 Oct 2010, 5:20 PM
#948
dvdtitan avatar

dvdtitan

New Zenner

Join Date:
Apr 2007
Posts:
87
Plugin Contributions:
0

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

creinold:

WHat and whos version are you using. I think my last version fixed this but it was for 1.3.9E

I am using your version. The latest version of zencart released today (1.39h) requires an update of the two files mentioned, which are files your SBA also modifies to prevent checkout on out of stock items.

There has been changes to these files in 1.39h from 1.39g and before.

27 Oct 2010, 5:44 PM
#949
creinold avatar

creinold

Zen Follower

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

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

I'm working on the update. Just downloaded the new zen version and will merge them together. I should hopeful have it done in a few days. Busy week, I haven't touch the files since version E due to some personal life issues.

27 Oct 2010, 6:00 PM
#950
creinold avatar

creinold

Zen Follower

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

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

Try this for the shopping cart header.php file

<?php
/**
 * shopping_cart header_php.php
 *
 * @package page
 * @copyright Copyright 2003-2010 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: header_php.php 17948 2010-10-13 20:33:18Z drbyte $
 */

// This should be first line of the script:
$zco_notifier->notify('NOTIFY_HEADER_START_SHOPPING_CART');

require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
$breadcrumb->add(NAVBAR_TITLE);

// Validate Cart for checkout
$_SESSION['valid_to_checkout'] = true;
$_SESSION['cart_errors'] = '';
$_SESSION['cart']->get_products(true);

if (!$_SESSION['valid_to_checkout']) {
  $messageStack->add('shopping_cart', ERROR_CART_UPDATE . $_SESSION['cart_errors'] , 'caution');
}

// build shipping with Tare included
$shipping_weight = $_SESSION['cart']->show_weight();
/*
  $shipping_weight = 0;
  require(DIR_WS_CLASSES . 'order.php');
  $order = new order;
  require_once('includes/classes/http_client.php'); // shipping in basket
  $total_weight = $_SESSION['cart']->show_weight();
  $total_count = $_SESSION['cart']->count_contents();
  require(DIR_WS_CLASSES . 'shipping.php');
  $shipping_modules = new shipping;
  $quotes = $shipping_modules->quote();
*/
$totalsDisplay = '';
switch (true) {
  case (SHOW_TOTALS_IN_CART == '1'):
  $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . TEXT_TOTAL_WEIGHT . $shipping_weight . TEXT_PRODUCT_WEIGHT_UNIT . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
  break;
  case (SHOW_TOTALS_IN_CART == '2'):
  $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . ($shipping_weight > 0 ? TEXT_TOTAL_WEIGHT . $shipping_weight . TEXT_PRODUCT_WEIGHT_UNIT : '') . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
  break;
  case (SHOW_TOTALS_IN_CART == '3'):
  $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
  break;
}

// testing/debugging
//  require(DIR_WS_MODULES . 'debug_blocks/shopping_cart_contents.php');

$flagHasCartContents = ($_SESSION['cart']->count_contents() > 0);
$cartShowTotal = $currencies->format($_SESSION['cart']->show_total());

$flagAnyOutOfStock = false;
$products = $_SESSION['cart']->get_products();
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
  if (($i/2) == floor($i/2)) {
    $rowClass="rowEven";
  } else {
    $rowClass="rowOdd";
  }
  switch (true) {
    case (SHOW_SHOPPING_CART_DELETE == 1):
    $buttonDelete = true;
    $checkBoxDelete = false;
    break;
    case (SHOW_SHOPPING_CART_DELETE == 2):
    $buttonDelete = false;
    $checkBoxDelete = true;
    break;
    default:
    $buttonDelete = true;
    $checkBoxDelete = true;
    break;
    $cur_row++;
  } // end switch
  $attributeHiddenField = "";
  $attrArray = false;
  $productsName = $products[$i]['name'];
  // Push all attributes information in an array
  if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
    if (PRODUCTS_OPTIONS_SORT_ORDER=='0') {
      $options_order_by= ' ORDER BY LPAD(popt.products_options_sort_order,11,"0")';
    } else {
      $options_order_by= ' ORDER BY popt.products_options_name';
    }
    foreach ($products[$i]['attributes'] as $option => $value) {
      $attributes = "SELECT popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix
                     FROM " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
                     WHERE pa.products_id = :productsID
                     AND pa.options_id = :optionsID
                     AND pa.options_id = popt.products_options_id
                     AND pa.options_values_id = :optionsValuesID
                     AND pa.options_values_id = poval.products_options_values_id
                     AND popt.language_id = :languageID
                     AND poval.language_id = :languageID " . $options_order_by;

      $attributes = $db->bindVars($attributes, ':productsID', $products[$i]['id'], 'integer');
      $attributes = $db->bindVars($attributes, ':optionsID', $option, 'integer');
      $attributes = $db->bindVars($attributes, ':optionsValuesID', $value, 'integer');
      $attributes = $db->bindVars($attributes, ':languageID', $_SESSION['languages_id'], 'integer');
      $attributes_values = $db->Execute($attributes);
      //clr 030714 determine if attribute is a text attribute and assign to $attr_value temporarily
      if ($value == PRODUCTS_OPTIONS_VALUES_TEXT_ID) {
        $attributeHiddenField .= zen_draw_hidden_field('id[' . $products[$i]['id'] . '][' . TEXT_PREFIX . $option . ']',  $products[$i]['attributes_values'][$option]);
        $attr_value = htmlspecialchars($products[$i]['attributes_values'][$option], ENT_COMPAT, CHARSET, TRUE);
      } else {
        $attributeHiddenField .= zen_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
        $attr_value = $attributes_values->fields['products_options_values_name'];
      }

      $attrArray[$option]['products_options_name'] = $attributes_values->fields['products_options_name'];
      $attrArray[$option]['options_values_id'] = $value;
      $attrArray[$option]['products_options_values_name'] = $attr_value;
      $attrArray[$option]['options_values_price'] = $attributes_values->fields['options_values_price'];
      $attrArray[$option]['price_prefix'] = $attributes_values->fields['price_prefix'];
    }
  } //end foreach [attributes]
  if (STOCK_CHECK == 'true') {
    $flagStockCheck = zen_check_stock($products[$i]['id'], $products[$i]['quantity'],$attributes);
    if ($flagStockCheck == true) {
      $flagAnyOutOfStock = true;
    }
  }
  $linkProductsImage = zen_href_link(zen_get_info_page($products[$i]['id']), 'products_id=' . $products[$i]['id']);
  $linkProductsName = zen_href_link(zen_get_info_page($products[$i]['id']), 'products_id=' . $products[$i]['id']);
  $productsImage = (IMAGE_SHOPPING_CART_STATUS == 1 ? zen_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT) : '');
  $show_products_quantity_max = zen_get_products_quantity_order_max($products[$i]['id']);
  $showFixedQuantity = (($show_products_quantity_max == 1 or zen_get_products_qty_box_status($products[$i]['id']) == 0) ? true : false);
//  $showFixedQuantityAmount = $products[$i]['quantity'] . zen_draw_hidden_field('products_id[]', $products[$i]['id']) . zen_draw_hidden_field('cart_quantity[]', 1);
//  $showFixedQuantityAmount = $products[$i]['quantity'] . zen_draw_hidden_field('cart_quantity[]', 1);
  $showFixedQuantityAmount = $products[$i]['quantity'] . zen_draw_hidden_field('cart_quantity[]', $products[$i]['quantity']);
  $showMinUnits = zen_get_products_quantity_min_units_display($products[$i]['id']);
  $quantityField = zen_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"');
  $buttonUpdate = ((SHOW_SHOPPING_CART_UPDATE == 1 or SHOW_SHOPPING_CART_UPDATE == 3) ? zen_image_submit(ICON_IMAGE_UPDATE, ICON_UPDATE_ALT) : '') . zen_draw_hidden_field('products_id[]', $products[$i]['id']);
  $tmp =  zen_add_tax($products[$i]['final_price'],zen_get_tax_rate($products[$i]['tax_class_id']));
//  $productsPriceEach = $currencies->rateAdjusted($tmp);
//  $productsPriceTotal = $productsPriceEach * $products[$i]['quantity'];
  $productsPriceTotal = $currencies->display_price($products[$i]['final_price'], zen_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . ($products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->display_price($products[$i]['onetime_charges'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) : '');
  $productsPriceEach = $currencies->display_price($products[$i]['final_price'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) . ($products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->display_price($products[$i]['onetime_charges'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) : '');
//  $productsPriceTotal = $currencies->display_price($products[$i]['final_price'], zen_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . ($products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->display_price($products[$i]['onetime_charges'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) : '');
//  echo  $currencies->rateAdjusted($tmp);
  $productArray[$i] = array('attributeHiddenField'=>$attributeHiddenField,
                            'flagStockCheck'=>$flagStockCheck,
                            'flagShowFixedQuantity'=>$showFixedQuantity,
                            'linkProductsImage'=>$linkProductsImage,
                            'linkProductsName'=>$linkProductsName,
                            'stockAvailable'=>$stockAvailable,
                            'productsImage'=>$productsImage,
                            'productsName'=>$productsName,
                            'showFixedQuantity'=>$showFixedQuantity,
                            'showFixedQuantityAmount'=>$showFixedQuantityAmount,
                            'showMinUnits'=>$showMinUnits,
                            'quantityField'=>$quantityField,
                            'buttonUpdate'=>$buttonUpdate,
                            'productsPrice'=>$productsPriceTotal,
                            'productsPriceEach'=>$productsPriceEach,
                            'rowClass'=>$rowClass,
                            'buttonDelete'=>$buttonDelete,
                            'checkBoxDelete'=>$checkBoxDelete,
                            'id'=>$products[$i]['id'],
                            'attributes'=>$attrArray);
} // end FOR loop


// This should be last line of the script:
$zco_notifier->notify('NOTIFY_HEADER_END_SHOPPING_CART');
?>
1 Nov 2010, 10:09 PM
#952
aszu avatar

aszu

New Zenner

Join Date:
Oct 2010
Posts:
15
Plugin Contributions:
0

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

creinold, i updated sba to 1.3.9h and i still have the same problem as described in post #932

any idea hwo to fix it?

2 Nov 2010, 2:33 PM
#953
linnx avatar

linnx

Zen Follower

Join Date:
Jun 2009
Posts:
187
Plugin Contributions:
0

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

It will be fantastic if this works! I've had so many issues with attribute stock not subtracting after cart upgrades. I don't believe this is the one I have been using. May have to give it a try!

Thanks for the hard work.

2 Nov 2010, 2:37 PM
#954
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

linnx:

It will be fantastic if this works! I've had so many issues with attribute stock not subtracting after cart upgrades. I don't believe this is the one I have been using. May have to give it a try!.That sounds like a problem with your approach to upgrading. This can happen if the changes that this mod makes to existing files, especially the order.php class, aren't properly merged into the core Zen Cart files as part of the upgrade.

2 Nov 2010, 8:45 PM
#955
creinold avatar

creinold

Zen Follower

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

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

aszu:

creinold, i updated sba to 1.3.9h and i still have the same problem as described in post #932

any idea hwo to fix it?

Never seen this happen, got a link where I can test it to see what is going on? You can PM it if you like.

Thanks Charles

4 Nov 2010, 10:34 AM
#956
revski avatar

revski

New Zenner

Join Date:
Nov 2010
Posts:
6
Plugin Contributions:
0

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

rodfarrell:

I have installed 1.3.9d (my first zencart) and Stock by Attributes 1-4-10.

The Stock by Attributes doesn't show in the admin screen. I have run the SQL patch and copied the files as per the Readme except that the install instructions refer to a file includes/modules/YOUR_TEMPLATE that needs to be renamed but this doesn't exist in the download. Can anyone tell me what I am missing.

This is my second post on this, the first seems to have been removed???

I've posted this in another topic, but this one seems to be more busy. I'm coping with the same problem. I renamed the only folder I found, created the table in the database, copied the files but nothing appeared in my admin panel. I guess I'm missing something, but havent found any solution yet. I welcome any help, thanks in advance.

4 Nov 2010, 7:11 PM
#957
artrat avatar

artrat

New Zenner

Join Date:
Aug 2007
Location:
NY
Posts:
26
Plugin Contributions:
0

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

hello, i have upgraded to 1.3.9h and added 1.4.10 attribute mod.
For some reason the code isn't applying my database prefix (which is zen_) when i try to update the attribute quantities.
i get an error message:

1146 Table 'MYDATABASE.products_with_attributes_stock' doesn't exist
in:
[UPDATE products_with_attributes_stock SET quantity = '0' WHERE products_with_attributes_stock.stock_id =131 LIMIT 1]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.

that is when i use the save button with the new ajax feature, updating multiple quantities at once.

there is no error when i use the regular old slow one item at a time one attribute at a time method (edit quantity button)

what might have i missed for the database prefix error?

4 Nov 2010, 7:41 PM
#958
artrat avatar

artrat

New Zenner

Join Date:
Aug 2007
Location:
NY
Posts:
26
Plugin Contributions:
0

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

revski: look for includes/templates/YOUR_TEMPLATE
not includes/modules/YOUR_TEMPLATE
rename the YOUR_TEMPLATE folder to the name of the template you use, then upload.

4 Nov 2010, 9:07 PM
#959
revski avatar

revski

New Zenner

Join Date:
Nov 2010
Posts:
6
Plugin Contributions:
0

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

ArtRat:

revski: look for includes/templates/YOUR_TEMPLATE
not includes/modules/YOUR_TEMPLATE
rename the YOUR_TEMPLATE folder to the name of the template you use, then upload.

So I'm not missing anything, thanks.
I ran the sql file, created the table, renamed the folder, copied into my zen cart installation, but I see no Products with Attributes in the Catalog menu. It's driving me nuts. It's a clean install, havent modified anything yet.

ps: I'm using 1.3.9h with the latest sba from creinold

4 Nov 2010, 9:39 PM
#960
revski avatar

revski

New Zenner

Join Date:
Nov 2010
Posts:
6
Plugin Contributions:
0

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

revski:

So I'm not missing anything, thanks.
I ran the sql file, created the table, renamed the folder, copied into my zen cart installation, but I see no Products with Attributes in the Catalog menu. It's driving me nuts. It's a clean install, havent modified anything yet.

ps: I'm using 1.3.9h with the latest sba from creinold

Nvm, fail of the year.