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

Results 821 to 840 of 3,609
11 Feb 2010, 4:03 PM
#821
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

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

cfsheridan:

I've done a bit of searching, and cannot find an answer other than a short discussion from 2006.

I sell green coffee by the pound, and the offerings are priced by attributes with 1#, 2#, 5#, 10#, and 20$ quantities offered. The problem is that there is not a stock quantity associated with the attributes, and it does not appear that this mod addresses attribute quantities where all the attribute items are merely different quantities of the same stock item. Does something like that exist, or alternatively, is there a way to price by quantity with discrete amounts available (the weights match my shipping packaging).

Thanks for the help.

site is www.noquartercoffee.comThe short answer is no. This module does not offer a mixed used of attributes where some attributes do not have a stock value associated with them. For example if you offer tee shirts in various Size/Color combos (where each combo has an associated stock value) AND then provide your customer with an option to personalize the tee shirt Size/Color combo you've selected. When you setup the stock for this product using this module, you would have to create a product variant which includes the personalization attribute along with the color and size attributes for each variant you setup.

That said you do not HAVE to setup product variants for products where there is no associated stock value for the various attribute variants.. You could simply use the default Zen Cart stock field in the product configuration and not create a variant at all for it using this module.. It's very flexible in that way..

11 Feb 2010, 4:38 PM
#822
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

cfsheridan:

I've done a bit of searching, and cannot find an answer other than a short discussion from 2006.

I sell green coffee by the pound, and the offerings are priced by attributes with 1#, 2#, 5#, 10#, and 20$ quantities offered. The problem is that there is not a stock quantity associated with the attributes, and it does not appear that this mod addresses attribute quantities where all the attribute items are merely different quantities of the same stock item. Does something like that exist, or alternatively, is there a way to price by quantity with discrete amounts available (the weights match my shipping packaging).Two possible approaches:

Firstly, you could create a category for each product like this and then make each variant a product within that category and edit the category listings for these products to look a little more like a product page (this idea originally came from Ajeh - does anybody know more about attributes?)

Secondly, you could go the whole hog and create a new type of attribute that carries a quantity and allows a quantity box to be displayed to collect it on the product page. I did a partial implementation of this for a client about a year ago (partial since they didn't need all the functionality that would be needed for this to be extended into a mod). Took about 3 days of design, development and testing - so not an easy option.

So two options, but both require a intermediate levels of knowledge of PHP and MySQL and advanced Zen Cart knowledge.

11 Feb 2010, 5:30 PM
#823
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

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

kuroi:

Two possible approaches:

Firstly, you could create a category for each product like this and then make each variant a product within that category and edit the category listings for these products to look a little more like a product page (this idea originally came from Ajeh - does anybody know more about attributes?)

Secondly, you could go the whole hog and create a new type of attribute that carries a quantity and allows a quantity box to be displayed to collect it on the product page. I did a partial implementation of this for a client about a year ago (partial since they didn't need all the functionality that would be needed for this to be extended into a mod). Took about 3 days of design, development and testing - so not an easy option.

So two options, but both require a intermediate levels of knowledge of PHP and MySQL and advanced Zen Cart knowledge.Taking copious notes from the master.. Thanks for the tip..:smile:

12 Feb 2010, 5:06 AM
#824
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

I am using this mod 4.7 with ZC 1.3.8a. Also using Product Attribute Grid Display Both were working well for few years. I apologize for cross posting but I'm not sure which mod is in play with my prob.

New problem arose - stock level is adjusted on products WITHOUT attributes when transacted, but stock levels are not adjusted when it is a stock with attributes.

I recently housecleaned my permissions at request of server....folders are 0755, files 0644, and config files 0444. Only other change in files was code mod of IH2 manager to set permissions of uploaded product photos.

Does this mod require a different permission setting somewhere in order to process the stock change?

12 Feb 2010, 11:04 AM
#825
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

soxophoneplayer:

Does this mod require a different permission setting somewhere in order to process the stock change?No, that sounds like a red herring to me. I'd check that your order.php class hasn't been over-written with a version that doesn't contain the stock by attributes code.

12 Feb 2010, 10:00 PM
#826
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

No, that sounds like a red herring to me. I'd check that your order.php class hasn't been over-written with a version that doesn't contain the stock by attributes code.

Right you are, thank you. My includes/classes/order.php, revision from 2009-07-12, had a snippet of code missing that I found on the 2007 version. Once merged, the attribute quanties do successfully adjust after a transaction. I thought it had been functioning properly before - perhaps I just noticed it this time because of a low quantity.

15 Feb 2010, 4:39 PM
#827
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

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

infocom:

For info, this add-on lists ALL products in one big list, so if you have thousands of products it takes ages to load and unmanageable.

So if interested I have added a very simple category listing function to show the category list first, then you click on a category to show products only in that category.
Attachment #7044

The out of memory problem still exists... I had to change our options and attributes to suit this add on to overcome this issue. Its when you have hundreds of attributes. It would be good to instead of adding unused attributes into the stock control, to ignore them for stock control instead. Then we probaby wont have this error.

Thanks

Hey infocom,

I had a look at your modified page and it works really well! nice touch with the images!,

However, for now I have reverted back to my file because I have a custom field in the database that I programmed to auto populate when adding quantities. Obviously I am now keen to try and transfer my code accross to your solution, however when I was looking at your code, straight away I was lost as there was two lots of query = 'insert into which on the original there was only one of these, and this is part of the code I modified... Wasnt sure what to do with it, or maybe to just repeat the same code twice? eitherway, I thought I had better try and get an understanding from you as to what the extra bit is doing??

my code modified the following:

$query = 'insert into `'.TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK.'` (`products_id`,`stock_attributes`,`quantity`) values ('.$products_id.',"'.$strAttributes.'",'.$quantity.') ON DUPLICATE KEY UPDATE `stock_attributes` = "'.$strAttributes.'", `quantity` = '.$quantity;
					$db->Execute($query);
				}

to

$query = 'insert into `'.TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK.'` (`products_id`,`stock_attributes`,`quantity`,`smiffy_id`) values ('.$products_id.',"'.$attributes.'",'.$quantity.',"'.$smiffy_id.'")';
		}

hope I am making sense... look forward to hearing from you.

PS - the search at the top didnt seem to work for me?

17 Feb 2010, 4:30 PM
#828
georgiebrown avatar

georgiebrown

New Zenner

Join Date:
Jan 2010
Posts:
8
Plugin Contributions:
0

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

Hi there,

I cleary must have gone wrong somewhere along the line as I do not seem to be able to find where I enter the stock value against the attributes for a product.

As far as I am aware I have followed the installation instructions ok.

Any guidance much appreciated.

17 Feb 2010, 4:57 PM
#829
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

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

GeorgieBrown:

Hi there,

I cleary must have gone wrong somewhere along the line as I do not seem to be able to find where I enter the stock value against the attributes for a product.

As far as I am aware I have followed the installation instructions ok.

Any guidance much appreciated.

To add quantitys to attributes you need to go to Catalog / Products with Attributes Stock

Here you should see a list of all products that have attributes assigned to them. click add quantity for variant, select your attribute type a stock level and your done. Afterward you need to sync stock. This adds up all the stock levels of the attributes and sets the main stock level for example:

S = 10
M = 12
L =1

Total stock 23

Hope that helps,
Phil :clap:


Online Fancy Dress

17 Feb 2010, 7:50 PM
#830
georgiebrown avatar

georgiebrown

New Zenner

Join Date:
Jan 2010
Posts:
8
Plugin Contributions:
0

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

Brilliant - thanks Phil!

7 Mar 2010, 5:25 PM
#831
infocom avatar

infocom

Zen Follower

Join Date:
Jul 2006
Location:
Cardiff, Wales
Posts:
308
Plugin Contributions:
0

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

@philip937

sorry philip937 only just ready your question to me...

I did not modify the code that much and did nothing with the insert scripts sorry. All I have done is show a category list at the start, and then filter the products by the category chosen. So I cant help with the issue on the insert or modified database you have sorry.

7 Mar 2010, 6:07 PM
#832
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

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

infocom:

@philip937

sorry philip937 only just ready your question to me...

I did not modify the code that much and did nothing with the insert scripts sorry. All I have done is show a category list at the start, and then filter the products by the category chosen. So I cant help with the issue on the insert or modified database you have sorry.

infocom,

thanks for getting back to me. I really like what you've done and really want to get it working with my modified products_with_attributes_stock.php

Is it easy to implement? As in would you be able to tell me what to add to my code to make it work, or if I were to post my code would you be able to add the necessary?

Cheers,
Phil


www.fanciedress.co.uk

7 Mar 2010, 6:46 PM
#833
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

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

philip937:

infocom,

thanks for getting back to me. I really like what you've done and really want to get it working with my modified products_with_attributes_stock.php

Is it easy to implement? As in would you be able to tell me what to add to my code to make it work, or if I were to post my code would you be able to add the necessary?

Cheers,
Phil


www.fanciedress.co.uk

Just been doing a comparison with my file and yours. Which version of products_with_attributes_stock.php did you use?

You seem to have this which I dont which is probably the bit i'm getting confused over:
/*
michael mcinally [email protected]
heavily modified version to allow inserting "ALL" attributes at once
also should probably run this SQL command as well:
ALTER TABLE products_with_attributes_stock ADD UNIQUE products_id_stock_attributes (products_id, stock_attributes);
*/
which i'm guessing has nothing to do with the filtering.. ?

11 Mar 2010, 1:59 PM
#834
irelandseye avatar

irelandseye

New Zenner

Join Date:
Oct 2009
Location:
Co Clare Ireland
Posts:
9
Plugin Contributions:
0

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

hi,

installed this mod... and the admin side seemed to work OK - I tested I could go in and set stock quantities by attrib etc - they would appear in the store etc etc - but checkout was broken.

So I read this thread and noticed a comment about putting backups of files into the same directory caused problems. so I moved my backups - the checkout is now working, but I can't now get into admin - I get the following:

Warning: include(includes/extra_configures/._email_use_8bit.php) [function.include]: failed to open stream: No such file or directory in /home/i53830/public_html/tradeonline/admin/includes/application_top.php on line 111

Warning: include(includes/extra_configures/._email_use_8bit.php) [function.include]: failed to open stream: No such file or directory in /home/i53830/public_html/tradeonline/admin/includes/application_top.php on line 111

Warning: include() [function.include]: Failed opening 'includes/extra_configures/._email_use_8bit.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/i53830/public_html/tradeonline/admin/includes/application_top.php on line 111

Warning: include(includes/extra_configures/._media_manager.php) [function.include]: failed to open stream: No such file or directory in /home/i53830/public_html/tradeonline/admin/includes/application_top.php on line 111

Warning: include(includes/extra_configures/._media_manager.php) [function.include]: failed to open stream: No such file or directory in /home/i53830/public_html/tradeonline/admin/includes/application_top.php on line 111

Warning: include() [function.include]: Failed opening 'includes/extra_configures/._media_manager.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/i53830/public_html/tradeonline/admin/includes/application_top.php on line 111

Warning: include(includes/extra_configures/._security_patch_v138_20090619.php) [function.include]: failed to open stream: No such file or directory in /home/i53830/public_html/tradeonline/admin/includes/application_top.php on line 111

Warning: include(includes/extra_configures/._security_patch_v138_20090619.php) [function.include]: failed to open stream: No such file or directory in /home/i53830/public_html/tradeonline/admin/includes/application_top.php on line 111

Warning: include() [function.include]: Failed opening 'includes/extra_configures/._security_patch_v138_20090619.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/i53830/public_html/tradeonline/admin/includes/application_top.php on line 111

Warning: require(includes/extra_datafiles/._music_type_database_names.php) [function.require]: failed to open stream: No such file or directory in /home/i53830/public_html/tradeonline/admin/includes/init_includes/init_file_db_names.php on line 40

Warning: require(includes/extra_datafiles/._music_type_database_names.php) [function.require]: failed to open stream: No such file or directory in /home/i53830/public_html/tradeonline/admin/includes/init_includes/init_file_db_names.php on line 40

Fatal error: require() [function.require]: Failed opening required 'includes/extra_datafiles/._music_type_database_names.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/i53830/public_html/tradeonline/admin/includes/init_includes/init_file_db_names.php on line 40

any ideas whats gone wrong?!! very frustrated!!!:frusty:

thanks!!!
clare....

18 Mar 2010, 3:41 AM
#835
green333 avatar

green333

Zen Follower

Join Date:
Mar 2008
Location:
QLD - Aussie
Posts:
190
Plugin Contributions:
0

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

Hi
I have spent quite sometime reading thru this thread, so thank you everyone for sharing insights & hints:clap:

I've downloaded the recommended stable version (4.7) , and now I'm just going thru & comparing files. I'm only very very very new to winmerge, and to be honest, 'merging' files still makes me very nervous.

The file to be overridden: includes/templates/template_default/templates/tpl_shopping_cart_default.php is the one causing me concern.

I've included my file, and the mod's file below. Just hoping that a wonderful Zen Cart merging guru could help me to work out how to merge these 2 files safely?

Many thanks:bigups:

Mod's File:

<?php /** * Page Template * * Loaded automatically by index.php?main_page=shopping_cart.<br /> * Displays shopping-cart contents * * @package templateSystem * @copyright Copyright 2003-2007 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: tpl_shopping_cart_default.php 2007-12-02 00:00:00Z kuroi $ */ ?> <div class="centerColumn" id="shoppingCartDefault"> <?php if ($flagHasCartContents) { ?> <?php if ($_SESSION['cart']->count_contents() > 0) { ?> <div class="forward"><?php echo TEXT_VISITORS_CART; ?></div> <?php } ?> <h1 id="cartDefaultHeading"><?php echo HEADING_TITLE; ?></h1> <?php if ($messageStack->size('shopping_cart') > 0) echo $messageStack->output('shopping_cart'); ?> <?php echo zen_draw_form('cart_quantity', zen_href_link(FILENAME_SHOPPING_CART, 'action=update_product')); ?> <div id="cartInstructionsDisplay" class="content"><?php echo TEXT_INFORMATION; ?></div> <?php if (!empty($totalsDisplay)) { ?> <div class="cartTotalsDisplay important"><?php echo $totalsDisplay; ?></div> <br class="clearBoth" /> <?php } ?> <?php if ($flagAnyOutOfStock) { ?> <?php if (STOCK_ALLOW_CHECKOUT == 'true') { ?> <div class="messageStackError"><?php echo OUT_OF_STOCK_CAN_CHECKOUT; ?></div> <?php } else { ?> <div class="messageStackError"><?php echo OUT_OF_STOCK_CANT_CHECKOUT; ?></div> <?php } //endif STOCK_ALLOW_CHECKOUT ?> <?php } //endif flagAnyOutOfStock ?> <table border="0" width="100%" cellspacing="0" cellpadding="0" id="cartContentsDisplay"> <tr class="tableHeading"> <th scope="col" id="scQuantityHeading"><?php echo TABLE_HEADING_QUANTITY; ?></th> <th scope="col" id="scUpdateQuantity"> </th> <th scope="col" id="scProductsHeading"><?php echo TABLE_HEADING_PRODUCTS; ?></th> <th scope="col" id="scUnitHeading"><?php echo TABLE_HEADING_PRICE; ?></th> <th scope="col" id="scTotalHeading"><?php echo TABLE_HEADING_TOTAL; ?></th> <th scope="col" id="scRemoveHeading"> </th> </tr> <!-- Loop through all products /--> <?php foreach ($productArray as $product) { ?> <tr class="<?php echo $product['rowClass']; ?>"> <td class="cartQuantity"> <?php if ($product['flagShowFixedQuantity']) { echo $product['showFixedQuantityAmount'] . '<br /><span class="alert bold">' . $product['flagStockCheck'] . '</span><br /><br />' . $product['showMinUnits']; } else { echo $product['quantityField'] . '<br /><span class="alert bold">' . $product['flagStockCheck'] . '</span><br /><br />' . $product['showMinUnits']; } ?> </td> <td class="cartQuantityUpdate"> <?php if ($product['buttonUpdate'] == '') { echo '' ; } else { echo $product['buttonUpdate']; } ?> </td> <td class="cartProductDisplay"> <a href="<?php echo $product['linkProductsName']; ?>"><span id="cartImage" class="back"><?php echo $product['productsImage']; ?></span><span id="cartProdTitle"><?php echo $product['productsName'] . '<span class="alert bold">' . $product['flagStockCheck'] . '</span>'; ?></span></a> <?php if ((STOCK_SHOW_LOW_IN_CART == 'true') && $product['flagStockCheck']) { echo '<span class="alert bold">'; echo PWA_STOCK_AVAILABLE; echo ((isset($product['stockAvailable'])) ? $product['stockAvailable']: 0); echo '</span>'; } ?> <br class="clearBoth" /> <?php echo $product['attributeHiddenField']; if (isset($product['attributes']) && is_array($product['attributes'])) { echo '<div class="cartAttribsList">'; echo '<ul>'; reset($product['attributes']); foreach ($product['attributes'] as $option => $value) { $product_options_name = $value['products_options_name']; $product_options_name_array = explode(":", $product_options_name); $product_options_name = $product_options_name_array[0]; ?> <li><?php echo $value['products_options_name'] . TEXT_OPTION_DIVIDER . nl2br($value['products_options_values_name']); ?></li> <?php } echo '</ul>'; echo '</div>'; } ?>
   </td>
   <td class="cartUnitDisplay"><?php echo $product['productsPriceEach']; ?></td>
   <td class="cartTotalDisplay"><?php echo $product['productsPrice']; ?></td>
   <td class="cartRemoveItemDisplay">
<?php if ($product['buttonDelete']) { ?>
       <a href="<?php echo zen_href_link(FILENAME_SHOPPING_CART, 'action=remove_product&product_id=' . $product['id']); ?>"><?php echo zen_image($template->get_template_dir(ICON_IMAGE_TRASH, DIR_WS_TEMPLATE, $current_page_base,'images/icons'). '/' . ICON_IMAGE_TRASH, ICON_TRASH_ALT); ?></a>
<?php } if ($product['checkBoxDelete'] ) { echo zen_draw_checkbox_field('cart_delete[]', $product['id']); } ?> </td> </tr> <?php } // end foreach ($productArray as $product) ?> <!-- Finished loop through all products /--> </table> <div id="cartSubTotal"><?php echo SUB_TITLE_SUB_TOTAL; ?> <?php echo $cartShowTotal; ?></div> <br class="clearBoth" /> <!--bof shopping cart buttons--> <div class="buttonRow forward"><?php echo '<a href="' . zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . zen_image_button(BUTTON_IMAGE_CHECKOUT, BUTTON_CHECKOUT_ALT) . '</a>'; ?></div> <div class="buttonRow back"><?php echo zen_back_link() . zen_image_button(BUTTON_IMAGE_CONTINUE_SHOPPING, BUTTON_CONTINUE_SHOPPING_ALT) . '</a>'; ?></div> <?php // show update cart button if (SHOW_SHOPPING_CART_UPDATE == 2 or SHOW_SHOPPING_CART_UPDATE == 3) { ?> <div class="buttonRow back"><?php echo zen_image_submit(ICON_IMAGE_UPDATE, ICON_UPDATE_ALT); ?></div> <?php } else { // don't show update button below cart ?> <?php } // show update button ?> <!--eof shopping cart buttons--> </form> <br class="clearBoth" /> <?php if (SHOW_SHIPPING_ESTIMATOR_BUTTON == '1') { ?> <div class="buttonRow back"><?php echo '<a href="javascript:popupWindow(\'' . zen_href_link(FILENAME_POPUP_SHIPPING_ESTIMATOR) . '\')">' . zen_image_button(BUTTON_IMAGE_SHIPPING_ESTIMATOR, BUTTON_SHIPPING_ESTIMATOR_ALT) . '</a>'; ?></div> <?php } ?> <!-- ** BEGIN PAYPAL EXPRESS CHECKOUT ** --> <?php // the tpl_ec_button template only displays EC option if cart contents >0 and value >0 if (defined('MODULE_PAYMENT_PAYPALWPP_STATUS') && MODULE_PAYMENT_PAYPALWPP_STATUS == 'True') { include(DIR_FS_CATALOG . DIR_WS_MODULES . 'payment/paypal/tpl_ec_button.php'); } ?> <!-- ** END PAYPAL EXPRESS CHECKOUT ** --> <?php if (SHOW_SHIPPING_ESTIMATOR_BUTTON == '2') { /** * load the shipping estimator code if needed */ ?>
  <?php require(DIR_WS_MODULES . zen_get_module_directory('shipping_estimator.php')); ?>
<?php } ?> <?php } else { ?> <h2 id="cartEmptyText"><?php echo TEXT_CART_EMPTY; ?></h2> <?php $show_display_shopping_cart_empty = $db->Execute(SQL_SHOW_SHOPPING_CART_EMPTY); while (!$show_display_shopping_cart_empty->EOF) { ?> <?php if ($show_display_shopping_cart_empty->fields['configuration_key'] == 'SHOW_SHOPPING_CART_EMPTY_FEATURED_PRODUCTS') { ?> <?php /** * display the Featured Products Center Box */ ?> <?php require($template->get_template_dir('tpl_modules_featured_products.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_featured_products.php'); ?> <?php } ?> <?php if ($show_display_shopping_cart_empty->fields['configuration_key'] == 'SHOW_SHOPPING_CART_EMPTY_SPECIALS_PRODUCTS') { ?> <?php /** * display the Special Products Center Box */ ?> <?php require($template->get_template_dir('tpl_modules_specials_default.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_specials_default.php'); ?> <?php } ?> <?php if ($show_display_shopping_cart_empty->fields['configuration_key'] == 'SHOW_SHOPPING_CART_EMPTY_NEW_PRODUCTS') { ?> <?php /** * display the New Products Center Box */ ?> <?php require($template->get_template_dir('tpl_modules_whats_new.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_whats_new.php'); ?> <?php } ?> <?php if ($show_display_shopping_cart_empty->fields['configuration_key'] == 'SHOW_SHOPPING_CART_EMPTY_UPCOMING') { include(DIR_WS_MODULES . zen_get_module_directory(FILENAME_UPCOMING_PRODUCTS)); } ?> <?php $show_display_shopping_cart_empty->MoveNext(); } // !EOF ?> <?php } ?> </div>

**

My current file:**

<?php /** * Page Template * * Loaded automatically by index.php?main_page=shopping_cart.<br /> * Displays shopping-cart contents * * @package templateSystem * @copyright Copyright 2003-2007 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: tpl_shopping_cart_default.php 6528 2007-06-25 23:25:27Z drbyte $ */ ?> <div class="centerColumn" id="shoppingCartDefault"> <?php if ($flagHasCartContents) { ?> <?php if ($_SESSION['cart']->count_contents() > 0) { ?> <div class="text_v_c"><?php echo TEXT_VISITORS_CART; ?></div> <?php } ?> <div class="side_left_2"> <div class="side_right_2"> <div class="side_top_2"> <div class="side_bot_2"> <div class="left_top_2"> <div class="right_top_2"> <div class="left_bot_2"> <div class="right_bot_2"> <h1 id="cartDefaultHeading"><?php echo HEADING_TITLE; ?></h1> </div> </div> </div> </div> </div> </div> </div> </div> <?php if ($messageStack->size('shopping_cart') > 0) echo $messageStack->output('shopping_cart'); ?> <?php echo zen_draw_form('cart_quantity', zen_href_link(FILENAME_SHOPPING_CART, 'action=update_product')); ?> <div id="cartInstructionsDisplay" class="content"><?php echo TEXT_INFORMATION; ?></div> <?php if (!empty($totalsDisplay)) { ?> <div class="cartTotalsDisplay important"><?php echo $totalsDisplay; ?></div> <br class="clearBoth" /> <?php } ?> <?php if ($flagAnyOutOfStock) { ?> <?php if (STOCK_ALLOW_CHECKOUT == 'true') { ?> <div class="messageStackError"><?php echo OUT_OF_STOCK_CAN_CHECKOUT; ?></div> <?php } else { ?> <div class="messageStackError"><?php echo OUT_OF_STOCK_CANT_CHECKOUT; ?></div> <?php } //endif STOCK_ALLOW_CHECKOUT ?> <?php } //endif flagAnyOutOfStock ?> <table border="0" width="100%" cellspacing="0" cellpadding="0" id="cartContentsDisplay"> <tr class="tableHeading"> <th scope="col" id="scQuantityHeading"><?php echo TABLE_HEADING_QUANTITY; ?></th> <th scope="col" id="scProductsHeading"><?php echo TABLE_HEADING_PRODUCTS; ?></th> <th scope="col" id="scTotalHeading"><?php echo TABLE_HEADING_TOTAL; ?></th> <th scope="col" id="scRemoveHeading"><?php echo TABLE_HEADING_REMOVE; ?></th> </tr> <!-- Loop through all products /--> <?php foreach ($productArray as $product) { ?> <tr class="<?php echo $product['rowClass']; ?>"> <td class="cartQuantity"> <?php if ($product['flagShowFixedQuantity']) { echo $product['showFixedQuantityAmount'] . '<br /><span class="alert bold">' . $product['flagStockCheck'] . '</span><br />' . $product['showMinUnits']; } else { echo $product['quantityField'] . '<br /><span class="alert bold">' . $product['flagStockCheck'] . '</span><br />' . $product['showMinUnits']; } ?> <div class="buttonRow"> <?php if ($product['buttonUpdate'] == '') { echo '' ; } else { echo $product['buttonUpdate']; } ?> </div> <?php echo '<br /><br />'; ?> </td> <td class="cartProductDisplay"> <a href="<?php echo $product['linkProductsName']; ?>"><span id="cartImage" class="back"><?php echo $product['productsImage']; ?></span><span id="cartProdTitle"><?php echo $product['productsName'] . '<span class="alert bold">' . $product['flagStockCheck'] . '</span>'; ?></span></a> <br class="clearBoth" /> <?php echo $product['attributeHiddenField']; if (isset($product['attributes']) && is_array($product['attributes'])) { echo '<div class="cartAttribsList">'; echo '<ul>'; reset($product['attributes']); foreach ($product['attributes'] as $option => $value) { ?> <li><?php echo $value['products_options_name'] . TEXT_OPTION_DIVIDER . nl2br($value['products_options_values_name']); ?></li> <?php } echo '</ul>'; echo '</div>'; } ?>
   </td>
   <td class="cartTotalDisplay"><?php echo $product['productsPrice']; ?></td>
   <td class="cartRemoveItemDisplay"><div class="buttonRow3">
<?php if ($product['checkBoxDelete'] ) { echo zen_draw_checkbox_field('cart_delete[]', $product['id']); } ?> <?php echo '</div><br /><br />'; ?> <div class="buttonRow"><?php if ($product['buttonDelete']) { ?> <a href="<?php echo zen_href_link(FILENAME_SHOPPING_CART, 'action=remove_product&product_id=' . $product['id']); ?>"><?php echo zen_image($template->get_template_dir(ICON_IMAGE_TRASH, DIR_WS_TEMPLATE, $current_page_base,'images/icons'). '/' . ICON_IMAGE_TRASH, ICON_TRASH_ALT); ?></a> <?php } ?></div> </td> </tr> <?php } // end foreach ($productArray as $product) ?>
   <!-- Finished loop through all products /-->
  </table>
<div id="cartSubTotal"><?php echo SUB_TITLE_SUB_TOTAL; ?> <strong><?php echo $cartShowTotal; ?></strong></div> <br class="clearBoth" /> <!--bof shopping cart buttons--> <div class="buttonRow forward"><?php echo '<a href="' . zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . zen_image_button(BUTTON_IMAGE_CHECKOUT, BUTTON_CHECKOUT_ALT) . '</a>'; ?></div> <div class="buttonRow back"><?php echo zen_back_link() . zen_image_button(BUTTON_IMAGE_CONTINUE_SHOPPING, BUTTON_CONTINUE_SHOPPING_ALT) . '</a>'; ?></div> <?php // show update cart button if (SHOW_SHOPPING_CART_UPDATE == 2 or SHOW_SHOPPING_CART_UPDATE == 3) { ?> <div class="buttonRow back"><?php echo zen_image_submit(ICON_IMAGE_UPDATE, ICON_UPDATE_ALT); ?></div> <?php } else { // don't show update button below cart ?> <?php } // show update button ?> <!--eof shopping cart buttons--> </form> <br class="clearBoth" /> <?php if (SHOW_SHIPPING_ESTIMATOR_BUTTON == '1') { ?> <div class="buttonRow back"><?php echo '<a href="javascript:popupWindow(\'' . zen_href_link(FILENAME_POPUP_SHIPPING_ESTIMATOR) . '\')">' . zen_image_button(BUTTON_IMAGE_SHIPPING_ESTIMATOR, BUTTON_SHIPPING_ESTIMATOR_ALT) . '</a>'; ?></div> <?php } ?> <!-- ** BEGIN PAYPAL EXPRESS CHECKOUT ** --> <?php // the tpl_ec_button template only displays EC option if cart contents >0 and value >0 if (defined('MODULE_PAYMENT_PAYPALWPP_STATUS') && MODULE_PAYMENT_PAYPALWPP_STATUS == 'True') { include(DIR_FS_CATALOG . DIR_WS_MODULES . 'payment/paypal/tpl_ec_button.php'); } ?> <!-- ** END PAYPAL EXPRESS CHECKOUT ** --> <?php if (SHOW_SHIPPING_ESTIMATOR_BUTTON == '2') { /** * load the shipping estimator code if needed */ ?>
  <?php require(DIR_WS_MODULES . zen_get_module_directory('shipping_estimator.php')); ?>
<?php } ?> <?php } else { ?> <h2 id="cartEmptyText"><?php echo TEXT_CART_EMPTY; ?></h2> <?php $show_display_shopping_cart_empty = $db->Execute(SQL_SHOW_SHOPPING_CART_EMPTY); while (!$show_display_shopping_cart_empty->EOF) { ?> <?php if ($show_display_shopping_cart_empty->fields['configuration_key'] == 'SHOW_SHOPPING_CART_EMPTY_FEATURED_PRODUCTS') { ?> <?php /** * display the Featured Products Center Box */ ?> <?php require($template->get_template_dir('tpl_modules_featured_products.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_featured_products.php'); ?> <?php } ?> <?php if ($show_display_shopping_cart_empty->fields['configuration_key'] == 'SHOW_SHOPPING_CART_EMPTY_SPECIALS_PRODUCTS') { ?> <?php /** * display the Special Products Center Box */ ?> <?php require($template->get_template_dir('tpl_modules_specials_default.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_specials_default.php'); ?> <?php } ?> <?php if ($show_display_shopping_cart_empty->fields['configuration_key'] == 'SHOW_SHOPPING_CART_EMPTY_NEW_PRODUCTS') { ?> <?php /** * display the New Products Center Box */ ?> <?php require($template->get_template_dir('tpl_modules_whats_new.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_whats_new.php'); ?> <?php } ?> <?php if ($show_display_shopping_cart_empty->fields['configuration_key'] == 'SHOW_SHOPPING_CART_EMPTY_UPCOMING') { include(DIR_WS_MODULES . zen_get_module_directory(FILENAME_UPCOMING_PRODUCTS)); } ?> <?php $show_display_shopping_cart_empty->MoveNext(); } // !EOF ?> <?php } ?> </div>
18 Mar 2010, 9:03 PM
#836
green333 avatar

green333

Zen Follower

Join Date:
Mar 2008
Location:
QLD - Aussie
Posts:
190
Plugin Contributions:
0

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

Hi all,
:blush: I'm still hoping that someone can help me regarding my file merging question (previous post)
I'm OK with the fields that can be just merged across, but there are a couple of areas that I really am unsure about.

(I'm afraid that I really am a coward when it comes to this - sorry...:cry:) But - happy to learn

19 Mar 2010, 4:52 AM
#837
green333 avatar

green333

Zen Follower

Join Date:
Mar 2008
Location:
QLD - Aussie
Posts:
190
Plugin Contributions:
0

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

I've been looking at this all day...and have isolated my 'merging woes' down to the following snippets (I really hope this isn't an imposition ...)

line 23 (orig file)

<<div class="text_v_c"><?php echo TEXT_VISITORS_CART; ?></div>
```mod's file

```php
<div class="forward"><?php echo TEXT_VISITORS_CART; ?></div>
```line 59 (orig file)

```php
        <th scope="col" id="scRemoveHeading"><?php echo TABLE_HEADING_REMOVE; ?></th>
```mod's file
```php
        <th scope="col" id="scRemoveHeading"> </th>
```line 74 (orig file)
```php
<div class="buttonRow">
```mod's file

```php
       </td>
       <td class="cartQuantityUpdate">
```line 126 (orig file)
```php
?></div>
```Mod's file
```php
  if ($product['checkBoxDelete'] ) {
    echo zen_draw_checkbox_field('cart_delete[]', $product['id']);
  }
?>
```Line 138 orig file
```php
<div id="cartSubTotal"><?php echo SUB_TITLE_SUB_TOTAL; ?> <strong><?php echo $cartShowTotal; ?></strong></div>
```mod's file
```php
<div id="cartSubTotal"><?php echo SUB_TITLE_SUB_TOTAL; ?> <?php echo $cartShowTotal; ?></div>
```I hope that someone can enlighten me - thank you so much
30 Mar 2010, 6:51 PM
#838
jage avatar

jage

New Zenner

Join Date:
Mar 2010
Posts:
5
Plugin Contributions:
0

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

ZC 1.3.8 and SbA 4.7 both fresh installs:

OK, I'm trying to figure out how products_with_attributes_stock.stock_attributes relates to anything.

My attributes (products_attributes.options_values_id) are 6,1,2,3,4,5 and my stock_attributes are 3,4,5,6,7,8. These each repeat for each of the 5 products for which I have attributes.

My products_options_values.products_options_values_id are 0,1,2,3,4,5,6 (0 being TEXT)

Only 1 type of product option, and products_options_values_to_products_options has 6 rows corresponding to products_options_values_to_products_options_id and products_options_values_id 1,2,3,4,5,6 all for products_options_id of 1.

So, again, stock_attributes with 3,4,5,6,7,8 is the odd ID out. How do I relate stock_attributes to any of the other ids? Everything seems to work as expected, but I can't do any SQL with stock_attributes.

20 Apr 2010, 5:24 AM
#839
feanix02 avatar

feanix02

New Zenner

Join Date:
Dec 2008
Posts:
14
Plugin Contributions:
0

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

Does anyone have a link to this mod in action? I have a few questions regarding how it works from the customers end.

Does it show out of stock on the product page level? Example, 1 item, with 4 attributes being seperate colors, 1 of the colors is out of stock. Does the mod prevent the out of stock color from being added to the shopping cart?

Thank you!

20 Apr 2010, 8:23 AM
#840
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

@Green333

You're using a template structured rather differently to a normal template. That huge mess of nested divs makes me suspect that it comes from Template Monster. It also means that the lines won't match up.

If you zip up and post the actual template file (rather than pasting it here where it loses a lot of it's formatting) I'll take a look.