-
Couple of small mods you might be interesed in:
First... this 2-liner will pre-fill the quantity box when you are editing a stock level. This seems logical to me so that you have a visual reminder of what stock is currently entered.
in /admin/includes/products_with_attributes_stock.php, Find (Line 349 of a fresh copy)
Code:
echo '<p><strong>Quantity: </strong>'.zen_draw_input_field('quantity').'</p>'."\n";
And replace with
Code:
echo '<p><strong>Quantity: </strong>'.zen_draw_input_field('quantity', $_GET['q']).'</p>'."\n"; //s_mack:prefill_quantity
And find (Line 458 of a fresh copy)
Code:
echo '<a href="'.zen_href_link(FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK, "action=edit&products_id=".$products->fields['products_id'].'&attributes='.$attribute_products->fields['stock_attributes'], 'NONSSL').'">Edit Quantity</a>';
And replace with
Code:
echo '<a href="'.zen_href_link(FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK, "action=edit&products_id=".$products->fields['products_id'].'&attributes='.$attribute_products->fields['stock_attributes'].'&q='.$attribute_products->fields['quantity'], 'NONSSL').'">Edit Quantity</a>'; //s_mack:prefill_quantity
The second mod is a little more involved. This skips the confirmation step for add and edit. It bugged me when I was trying to change the quantity on several items - its kinda useless anyway. The changes are to the same file as the above mod... its too sporatic to show the changes individually, so here is the file in its entirety - look for lines that end with "s_mack:noconfirm".
Code:
<?php
//
// +----------------------------------------------------------------------+
// |zen-cart Open Source E-commerce |
// +----------------------------------------------------------------------+
// | Copyright (c) 2003 The zen-cart developers |
// | |
// | http://www.zen-cart.com/index.php |
// | |
// | Portions Copyright (c) 2003 osCommerce |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at the following url: |
// | http://www.zen-cart.com/license/2_0.txt. |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to |
// | license AT zen-cart DOT com so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// $Id: orders.php 528 2004-11-10 15:56:02Z wilt $
//
/*
CREATE TABLE `zen_products_with_attributes_stock` (
`stock_id` INT NOT NULL AUTO_INCREMENT ,
`products_id` INT NOT NULL ,
`stock_attributes` VARCHAR( 255 ) NOT NULL ,
`quantity` INT NOT NULL ,
PRIMARY KEY ( `stock_id` )
)
*/
require('includes/application_top.php');
require(DIR_WS_CLASSES . 'currencies.php');
require(DIR_WS_CLASSES . 'products_with_attributes_stock.php');
$stock = new products_with_attributes_stock;
if(isset($_SESSION['language_id'])){ $language_id = $_SESSION['language_id'];} else { $language_id=1;}
if(isset($_GET['action']))
{
$action = $_GET['action'];
}
else
{
$action = '';
}
switch($action)
{
case 'add':
if(isset($_GET['products_id']) and is_numeric((int)$_GET['products_id']))
{
$products_id = (int)$_GET['products_id'];
}
if(isset($_POST['products_id']) and is_numeric((int)$_POST['products_id']))
{
$products_id = (int)$_POST['products_id'];
}
if(isset($products_id))
{
if(zen_products_id_valid($products_id))
{
$product_name = zen_get_products_name($products_id);
$product_attributes = $stock->get_products_attributes($products_id);
$hidden_form .= zen_draw_hidden_field('products_id',$products_id)."\n";
}
else
{
zen_redirect(zen_href_link(FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK, zen_get_all_get_params(array('action')), 'NONSSL'));
}
}
else
{
$query = 'SELECT DISTINCT
attrib.products_id, description.products_name
FROM
'.TABLE_PRODUCTS_ATTRIBUTES.' attrib, '.TABLE_PRODUCTS_DESCRIPTION.' description
WHERE
attrib.products_id = description.products_id and description.language_id='.$language_id.' order by description.products_name';
$products = $db->execute($query);
while(!$products->EOF)
{
$products_array_list[] = array(
'id' => $products->fields['products_id'],
'text' => $products->fields['products_name']
);
$products->MoveNext();
}
}
break;
case 'edit':
$hidden_form = '';
if(isset($_GET['products_id']) and is_numeric((int)$_GET['products_id']))
{
$products_id = $_GET['products_id'];
}
if(isset($_GET['attributes']))
{
$attributes = $_GET['attributes'];
}
if(isset($products_id) and isset($attributes))
{
$attributes = explode(',',$attributes);
foreach($attributes as $attribute_id){
$hidden_form .= zen_draw_hidden_field('attributes[]',$attribute_id)."\n";
$attributes_list[] = $stock->get_attributes_name($attribute_id);
}
$hidden_form .= zen_draw_hidden_field('products_id',$products_id)."\n";
}
else
{
zen_redirect(zen_href_link(FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK, zen_get_all_get_params(array('action')), 'NONSSL'));
}
break;
case 'confirm':
if(isset($_POST['products_id']) and is_numeric((int)$_POST['products_id']))
{
if(!isset($_POST['quantity']) || !is_numeric($_POST['quantity']))
{
zen_redirect(zen_href_link(FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK, zen_get_all_get_params(array('action')), 'NONSSL'));
}
$products_id = $_POST['products_id'];
$product_name = zen_get_products_name($products_id);
if(is_numeric($_POST['quantity']))
{
$quantity = $_POST['quantity'];
}
$attributes = $_POST['attributes'];
foreach($attributes as $attribute_id)
{
$hidden_form .= zen_draw_hidden_field('attributes[]',$attribute_id)."\n";
$attributes_list[] = $stock->get_attributes_name($attribute_id);
$s_mack_noconfirm .="attributes[]=" . $attribute_id . "&"; //s_mack:noconfirm
}
$hidden_form .= zen_draw_hidden_field('products_id',$products_id)."\n";
$hidden_form .= zen_draw_hidden_field('quantity',$quantity)."\n";
$s_mack_noconfirm .="products_id=" . $products_id . "&"; //s_mack:noconfirm
$s_mack_noconfirm .="quantity=" . $quantity . "&"; //s_mack:noconfirm
if(sizeof($attributes) > 1)
{
sort($attributes);
$stock_attributes = implode(',',$attributes);
}
else
{
$stock_attributes = $attributes[0];
}
$query = 'select * from '.TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK.' where products_id = '.$products_id.' and stock_attributes="'.$stock_attributes.'"';
$stock_check = $db->Execute($query);
if(!$stock_check->EOF)
{
$hidden_form .= zen_draw_hidden_field('add_edit','edit');
$hidden_form .= zen_draw_hidden_field('stock_id',$stock_check->fields['stock_id']);
$s_mack_noconfirm .="stock_id=" . $stock_check->fields['stock_id'] . "&"; //s_mack:noconfirm
$s_mack_noconfirm .="add_edit=edit&"; //s_mack:noconfirm
$add_edit = 'edit';
}
else
{
$hidden_form .= zen_draw_hidden_field('add_edit','add')."\n";
$s_mack_noconfirm .="add_edit=add&"; //s_mack:noconfirm
}
}
else
{
zen_redirect(zen_href_link(FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK, zen_get_all_get_params(array('action')), 'NONSSL'));
}
zen_redirect(zen_href_link(FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK, $s_mack_noconfirm . "action=execute", 'NONSSL')); //s_mack:noconfirm
break;
case 'execute':
$attributes = $_POST['attributes'];
if ($_GET['attributes']) { $attributes = $_GET['attributes']; } //s_mack:noconfirm
$products_id = $_POST['products_id'];
if ($_GET['products_id']) { $products_id = $_GET['products_id']; } //s_mack:noconfirm
/* s_mack:noconfirm
if(is_numeric((int)$_POST['quantity']))
{
$quantity = (int)$_POST['quantity'];
}
else
*/ s_mack:noconfirm
$quantity = $_GET['quantity']; //s_mack:noconfirm
if ($_GET['quantity']) { $quantity = $_GET['quantity']; } //s_mack:noconfirm
if(!is_numeric((int)$quantity)) //s_mack:noconfirm
{
zen_redirect(zen_href_link(FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK, zen_get_all_get_params(array('action')), 'NONSSL'));
}
if(sizeof($attributes) > 1)
{
sort($attributes);
$stock_attributes = implode(',',$attributes);
}
else
{
$stock_attributes = $attributes[0];
}
//if($_POST['add_edit'] == 'add')
if(($_POST['add_edit'] == 'add') || ($_GET['add_edit'] == 'add')) //s_mack:noconfirm
{
$query = 'insert into `'.TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK.'` (`products_id`,`stock_attributes`,`quantity`) values ('.$products_id.',"'.$stock_attributes.'",'.$quantity.')';
}
elseif(($_POST['add_edit'] == 'edit') || ($_GET['add_edit'] == 'edit')) //s_mack:noconfirm
//elseif($_POST['add_edit'] == 'edit')
{
/* s_mack:noconfirm
if(is_numeric((int)$_POST['stock_id']))
{
$stock_id = (int)$_POST['stock_id'];
}
else
*/ s_mack:noconfirm
$stock_id = $_POST['stock_id']; //s_mack:noconfirm
if ($_GET['stock_id']) { $stock_id = $_GET['stock_id']; } //s_mack:noconfirm
if(!is_numeric((int)$stock_id)) //s_mack:noconfirm
{
zen_redirect(zen_href_link(FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK, zen_get_all_get_params(array('action')), 'NONSSL'));
}
$query = 'update `'.TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK.'` set quantity='.$quantity.' where stock_id='.$stock_id.' limit 1';
}
$db->Execute($query);
$stock->update_parent_products_stock($products_id);
$messageStack->add_session('Product successfully updated', 'success');
zen_redirect(zen_href_link(FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK, '', 'NONSSL'));
break;
case 'delete':
if(!isset($_POST['confirm']))
{
// do nothing
}
else
{
// delete it
if($_POST['confirm'] == 'Yes'){
$query = 'delete from '.TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK.' where products_id="'.$_POST['products_id'].'" and stock_attributes="'.$_POST['attributes'].'" limit 1';
$db->Execute($query);
$stock->update_parent_products_stock((int)$_POST['products_id']);
$messageStack->add_session('Product Variant was deleted', 'failure');
zen_redirect(zen_href_link(FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK, '', 'NONSSL'));
} else {
zen_redirect(zen_href_link(FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK, '', 'NONSSL'));
}
}
break;
case 'resync':
if(is_numeric((int)$_GET['products_id'])){
$stock->update_parent_products_stock((int)$_GET['products_id']);
$messageStack->add_session('Parent Product Quantity Updated', 'success');
zen_redirect(zen_href_link(FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK, '', 'NONSSL'));
} else {
zen_redirect(zen_href_link(FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK, '', 'NONSSL'));
}
break;
default:
// Show a list of the products
break;
}
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
<script language="javascript" type="text/javascript" src="includes/menu.js"></script>
<script language="javascript" type="text/javascript" src="includes/general.js"></script>
<script type="text/javascript">
<!--
function init()
{
cssjsmenu('navbar');
if (document.getElementById)
{
var kill = document.getElementById('hoverJS');
kill.disabled = true;
}
}
// -->
</script>
</head>
<body onload="init()">
<!-- header //-->
<?php
require(DIR_WS_INCLUDES . 'header.php');
?>
<!-- header_eof //-->
<div style="padding: 20px;">
<!-- body_text_eof //-->
<!-- body_eof //-->
<?
switch($action)
{
case 'add':
if(isset($products_id))
{
echo zen_draw_form('final_refund_exchange', FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK, 'action=confirm', 'post', '', true)."\n";
echo $hidden_form;
echo '<p><strong>'.$product_name.'</strong></p>';
foreach($product_attributes as $option_name => $options)
{
echo '<p><strong>'.$option_name.': </strong>';
echo zen_draw_pull_down_menu('attributes[]',$options).'</p>'."\n";
}
echo '<p><strong>Quantity: </strong>'.zen_draw_input_field('quantity').'</p>'."\n";
}
else
{
echo zen_draw_form('final_refund_exchange', FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK, 'action=add', 'post', '', true)."\n";
echo zen_draw_pull_down_menu('products_id',$products_array_list)."\n";
}
?>
<p><input type="submit" value="submit"></p>
</form>
<?
break;
case 'edit':
echo zen_draw_form('final_refund_exchange', FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK, 'action=confirm', 'post', '', true)."\n";
echo '<h3>'.zen_get_products_name($products_id).'</h3>';
foreach($attributes_list as $attributes)
{
echo '<p><strong>'.$attributes['option'].': </strong>'.$attributes['value'].'</p>';
}
echo $hidden_form;
echo '<p><strong>Quantity: </strong>'.zen_draw_input_field('quantity').'</p>'."\n";
?>
<p><input type="submit" value="submit"></p>
</form>
<?
break;
case 'delete':
if(!isset($_POST['confirm']))
{
echo zen_draw_form('final_refund_exchange', FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK, 'action=delete', 'post', '', true)."\n";
echo 'Are you sure you want to delete this product?';
foreach($_GET as $key=>$value)
{
echo zen_draw_hidden_field($key,$value);
}
?>
<p><input type="submit" value="Yes" name="confirm"> * <input type="submit" value="No" name="confirm"></p>
</form>
<?
}
break;
case 'confirm':
echo '<h3>Confirm '.$product_name.'</h3>';
foreach($attributes_list as $attributes)
{
echo '<p><strong>'.$attributes['option'].': </strong>'.$attributes['value'].'</p>';
}
echo '<p><strong>Quantity</strong>'.$quantity.'</p>';
echo zen_draw_form('final_refund_exchange', FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK, 'action=execute', 'post', '', true)."\n";
echo $hidden_form;
?>
<p><input type="submit" value="submit"></p>
</form>
<?
break;
default:
?>
<table width="100%" style="text-align: left">
<tr>
<th>Product ID</th>
<th>Product Name</th>
<th>Quantity of all variants</th>
<th>Add Quantity For Product Variant</th>
<th>Sync Quantities</th>
</tr>
<?
// Show a list of the products
$query = 'select distinct
attrib.products_id, description.products_name, products.products_quantity
FROM
'.TABLE_PRODUCTS_ATTRIBUTES.' attrib, '.TABLE_PRODUCTS_DESCRIPTION.' description, '.TABLE_PRODUCTS.' products
WHERE
attrib.products_id = description.products_id and
attrib.products_id = products.products_id and description.language_id='.$language_id.' order by description.products_name ';
$products = $db->Execute($query);
while(!$products->EOF)
{
echo '<tr style="background: #ccc">'."\n";
echo '<td>'.$products->fields['products_id'].'</td>';
echo '<td>'.$products->fields['products_name'].'</td>';
echo '<td>'.$products->fields['products_quantity'].'</td>';
echo '<td><a href="'.zen_href_link(FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK, "action=add&products_id=".$products->fields['products_id'], 'NONSSL').'">Add Quantity For Product Variant</a></td>';
echo '<td><a href="'.zen_href_link(FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK, "action=resync&products_id=".$products->fields['products_id'], 'NONSSL').'">Sync Quantities</a></td>';
echo '</tr>'."\n";
$query = 'select * from '.TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK.' where products_id="'.$products->fields['products_id'].'"';
$attribute_products = $db->Execute($query);
if($attribute_products->RecordCount() > 0)
{
echo '<tr>'."\n";
echo '<td colspan="5" style="padding:10px;">'."\n";
echo '<table width="100%" style="text-align: left">';
echo '<tr>';
echo '<th style="border-bottom: 1px solid #ccc">Stock id</th><th style="border-bottom: 1px solid #ccc">Variant</th><th style="border-bottom: 1px solid #ccc">Quantity in stock</th><th style="border-bottom: 1px solid #ccc">Edit</th><th style="border-bottom: 1px solid #ccc">Delete</th>';
echo '</tr>';
while(!$attribute_products->EOF)
{
echo '<tr>';
echo '<td style="border-bottom: 1px dashed #ccc">'."\n";
echo $attribute_products->fields['stock_id'];
echo '</td>'."\n";
echo '<td style="border-bottom: 1px dashed #ccc">'."\n";
$attributes_of_stock = explode(',',$attribute_products->fields['stock_attributes']);
$attributes_output = array();
foreach($attributes_of_stock as $attri_id)
{
$stock_attribute = $stock->get_attributes_name($attri_id);
$attributes_output[] = '<strong>'.$stock_attribute['option'].':</strong> '.$stock_attribute['value'].'<br/>';
}
sort($attributes_output);
echo implode("\n",$attributes_output);
echo '</td>'."\n";
echo '<td style="border-bottom: 1px dashed #ccc">'."\n";
echo $attribute_products->fields['quantity'];
echo '</td>'."\n";
echo '<td style="border-bottom: 1px dashed #ccc">'."\n";
echo '<a href="'.zen_href_link(FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK, "action=edit&products_id=".$products->fields['products_id'].'&attributes='.$attribute_products->fields['stock_attributes'], 'NONSSL').'">Edit Quantity</a>';
echo '</td>'."\n";
echo '<td style="border-bottom: 1px dashed #ccc">'."\n";
echo '<a href="'.zen_href_link(FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK, "action=delete&products_id=".$products->fields['products_id'].'&attributes='.$attribute_products->fields['stock_attributes'], 'NONSSL').'">Delete Variant</a>';
echo '</td>'."\n";
echo '</tr>';
$attribute_products->MoveNext();
}
echo '</table>';
echo '</td>'."\n";
echo '</tr>'."\n";
}
$products->MoveNext();
}
?>
</table>
<?
break;
}
?>
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br />
</div>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
- Steven
-
thanks s_mack
i will try both your suggestions and see how i get on :/
nice on :)
-
Geeze... ok, back to the drawing board.
A bit of obvious logic escaped me until now. Grayson... that code change you did to show stock leves for attributes... that won't work with more than one level (say size & color, for example), right? I fought with this all night until I finally realized that it would have to reload data to know now what attribute combination we're looking at. Yeah, yeah.. I know you guys already thought of this and that's where that ajax conversation came from. I skimmed through it and though that you had solved it :) My bad.
Ok, but maybe there is a way. Either with Ajax, or something simpler. I, like others here, don't like the idea of having a customer just take a shot in the dark and not know ahead of time if something is in stock or not so I want to get this resolved.
Ajax may be the way to go... but if we're going to do javascripting anyway maybe there is an alternative. Perhaps we can create a simple (not really scalable) database for the javascript to interact with... if the current selected permutation matches an entry in the database, then we can inform the user there is stock.
Downside (also with Ajax I believe) is that for really busy sites the item could very well be out of stock before the add to cart button is hit since the javascript db isn't dynamically tied to the sql db. That doesn't matter for my purposes.
Other downside (again, also with Ajax) is if JavaScript is disabled in the browser (less of a problem these days) it will not work.
- Steven
-
After playing around with things a bit, I've started to get it how I want it. It uses JavaScript... a language I have avoided for several years now so I'm am very rusty. You can see my work-in-progress implimentation here on my test site.
When the page first loads, and any time you change any of the attributes, it will show you an indication of stock levels. I've put both a text and image example there (the stars images were handy... changes between 0 or three if there is stock or not).
It will work with any number of attributes and any number of options per attribute - however the scalabilty of JS is pretty weak so if you have hundreds or even just dozens of permutations it may be problematic, I don't know.
It can easily be adapted to say "out of stock" instead of "0 in stock" of course... can be anything you want really. I imagine it wouldn't be too hard to dynamically remove elements that aren't in stock, if people found that to be useful.
If people want to work with this, there is some work left to do. 1) Cross-browserify it... I know there are tricks and pitfalls with JS so if someone more familiar with the language wants to have a look that would be great. 2) Some sort of handling in case there is no JS support on the browser (or ignore it and it will just behave like stock... they find out once they get to the checkout). 3) I got lazy and I'm sure I didnt' reference things properly (like hardcoding table names in the SQL queries).
Check it out. If there is interest I'll post some source. If not, I'll just use it for my own purposes without bothering to clean things up for readability.
- Steven
-
got this up and working fine on 1.27, only problem seems to be the link in admin is titled "FILENAME_PRODUCTS_WITH_ATTRIBUTES_STOCK"....where should i look to fix this up?
-
Kyle,
I'm also trying to install in a 1.2.7 store, but I just get a blank page when I go to the "Products with Attributes stock" page in the admin.
It may be because I've dowloaded an old version of this? It seems that upgrades and or changes that were mentioned in this thread were not applied to the version I downloaded.
It would be really great if the updated mod could be uploaded somewhere, vs. having to dig through the thread and find the changes?
For example, in the readme.txt, the incorrect SQL file is still listed.
Also, s_mack, on a post on the previous page (Feb 24 2006, 03:36 PM) You first list some changes to /admin/includes/products_with_attributes_stock.php (which I'm guess is a type and actually should be /admin/products_with_attributes_stock.php), then you post the entire /admin/products_with_attributes_stock.php file but without the changes you showed right above it. Which changes, if any, should we apply?
I'm not trying to be rude, I understand a lot of these mods and downloads are "as is", and are not guaranteed to work in all cases, but I think with offering mods for distribution, there comes a bit of responsibility to try and offer correct files, at least in my opinion. Or perhaps I'm just missing something obvious, where you listed an updated link?
Utterly confused,
-
I found the problem, the fixes below are for the original file from the download on page 1.
Though I don't see how the original file was working for anyone either? Unless this was an addressed issue somewhere in this thread that I missed. Or perhaps its only happening with my browser (I use Safari)
Anyway, my error log showed an error on line 201 of admin/produccts_with_attributes_stock.php. It said there was an unexpected ':'.
On line 201, I see this:
*/ s_mack:noconfirm
In dreamweaver, that s:mack:noconfirm isn't hidden text, so I chaged it to
s_mack:noconfirm */
so it is hidden. Now I can get to the page. This is also an issue on line 233. Same on the file you posted on the previous page.
-
Quote:
Originally posted by grayson@Feb 15 2006, 03:24 PM
If you want it to show up for dropdowns, you'll have to go searching in there to find where the text values for the dropdown menu entries get set, and add in this part:
Code:
' [' . $products_options->fields['quantity'] . ' '. TEXT_ATTRIBUTES_PIECES . ']'
I got this working.
Open up includes/modules/pages/product_info/main_template_vars_attributes.php
and around line 122 replace:
Code:
$products_options_array[] = array('id' => $products_options->fields['products_options_values_id'],
'text' => $products_options->fields['products_options_values_name']);
with
Code:
$products_options_array[] = array('id' => $products_options->fields['products_options_values_id'],
'text' => $products_options->fields['products_options_values_name'] .' [' . $products_options->fields['quantity'] . ' '. TEXT_ATTRIBUTES_PIECES . ']');
This is after applying the changes that grayson noted on page 14 of this thread.
See it in action here at a test site:
http://www.zencart.jadetrue.com/testing-pr...roduct-p-1.html
-
Great, jettrue! I think you probably have a very big kiss and maybe a box of chocolates coming from Yahaira :lol:
-
Yes, but try getting that to work if you have more than one attribute!
Which is the beauty of this contrib vs. the other one that's out there because it DOES work with multiple attributes... that modification, unfortunately, does not.
Jettrue - I hear you... it is a pain going through the entire thread. The problem is (as I just pointed out in the previous paragraph) is that not all the mods we are discussing here are compatible with one another or desired by all. I haven't confirmed whether or not I had typos, but changing the comments the way you did seems it would hide entire blocks... not what you want. I'll have a look.
*EDIT* You are correct. The file reference was a typo (no 'includes' part) and the comments were done poorly as you showed (odd that I didn't get an error though) as I've been working with a different language that comments like that. You seemed to be confused because the first set of mods I wrote weren't included in the 2nd set... that's because they are two seperate mods. That's the thing about mods, as I said above - not all are desired or compatible. In this case, they will work fine together but you might not want both. Who am I to package it up and say its the "right" package? *END_EDIT*
Everyone - a page or so back I posted what I had done to make dropdowns work WITH multiple attributes and posted a link to my site so you could see it in action... unfortunately, if any of you tested it before now you would have seen a "down for maintenance" (oops). I have corrected that so you can see it in action here. I'm constantly working on it so ignore the layout and crap - just see how it shows you the number of that combination in stock and changes the (meaningless) graphic above it.