Hi,
sorry to bother, but I would like some help. I'm not an expert so sorry if I won't be too much precise.
Well, after a long struggle I've came up with the e-store for my business: http://store.koti.it/catalog
The most is done, but I still need some tuning. This one in particular:
I've implemented the QTpro module that allow me to set a quantity to each attributes of a product. Here it is an example.
Now, what I what to do is to show the quantity available for each attribute INSIDE the drop down menu, rather than in the table underneath.
Something like: Color: pink (3 pcs) .
I've tried to mess around with the php files provided in the module, but my results were ridiculous.
I think I've detected the code lines that generates the drop down menu:
$out.='<p><strong style="margin-right: 10px">'.$attributes[$o]['oname'].":</strong>".tep_draw_pull_down_menu('id['.$attributes[$o]['oid'].']',array_values($attributes[$o]['ovals']),$attributes[$o]['default'], "onchange="stkmsg(this.form);"")."</p>n";
With some few extra strokes is it possible to implement the attribute quantity in the drop down menu?
Can anyone help?
My final objective is to add also a form field where the costumer could enter a desired quantity to order. But to do so, they should first of all now how many items are available.
Hope you can help, thanks a lot in advance!
Ricroma
EDIT: down here I attach all the code of the file:
<?php
/*
QT Pro Version 4.1
pad_multiple_dropdowns.php
Contribution extension to:
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2004, 2005 Ralph Day
Released under the GNU General Public License
Based on prior works released under the GNU General Public License:
QT Pro prior versions
Ralph Day, October 2004
Tom Wojcik aka TomThumb 2004/07/03 based on work by Michael Coffman aka coffman
FREEZEHELL - 08/11/2003
[email protected] Copyright (c) 2003 IBWO
Joseph Shain, January 2003
osCommerce MS2
Copyright (c) 2003 osCommerce
Modifications made:
11/2004 - Created
12/2004 - Fix _draw_out_of_stock_message_js to add semicolon to end of js stock array
03/2005 - Remove '&' for pass by reference from parameters to call of
_build_attributes_combinations. Only needed on method definition and causes
error messages on some php versions/configurations
*******************************************************************************************
QT Pro Product Attributes Display Plugin
pad_multiple_dropdowns.php - Display stocked product attributes first as one dropdown for each attribute.
Class Name: pad_multiple_dropdowns
This class generates the HTML to display product attributes. First, product attributes that
stock is tracked for are displayed, each attribute in its own dropdown list. Then attributes that
stock is not tracked for are displayed, each attribute in its own dropdown list.
Methods overidden or added:
_draw_stocked_attributes draw attributes that stock is tracked for
_draw_out_of_stock_message_js draw Javascript to display out of stock message for out of
stock attribute combinations
*/
require_once(DIR_WS_CLASSES . 'pad_base.php');
class pad_multiple_dropdowns extends pad_base {
/*
Method: _draw_stocked_attributes
draw dropdown lists for attributes that stock is tracked for
Parameters:
none
Returns:
string: HTML to display dropdown lists for attributes that stock is tracked for
*/
function _draw_stocked_attributes() {
global $languages_id;
$out='';
$attributes = $this->_build_attributes_array(true, false);
if (sizeof($attributes)>0) {
for($o=0; $o<sizeof($attributes); $o++) {
$s=sizeof($attributes[$o]['ovals']);
for ($a=0; $a<$s; $a++) {
$attribute_stock_query = tep_db_query("select products_stock_quantity from " . TABLE_PRODUCTS_STOCK . " where products_id = '" . (int)$this->products_id . "' AND products_stock_attributes REGEXP '(^|,)" . (int)$attributes[$o]['oid'] . "-" . (int)$attributes[$o]['ovals'][$a]['id'] . "(,|$)' AND products_stock_quantity > 0");
$out_of_stock=(tep_db_num_rows($attribute_stock_query)==0);
if ($out_of_stock && ($this->show_out_of_stock == 'True')) {
switch ($this->mark_out_of_stock) {
case 'Left': $attributes[$o]['ovals'][$a]['text']=TEXT_OUT_OF_STOCK.' - '.$attributes[$o]['ovals'][$a]['text'];
break;
case 'Right': $attributes[$o]['ovals'][$a]['text'].=' - '.TEXT_OUT_OF_STOCK;
break;
}
}
elseif ($out_of_stock && ($this->show_out_of_stock != 'True')) {
unset($attributes[$o]['ovals'][$a]);
}
}
$out.='<p><strong style="margin-right: 10px">'.$attributes[$o]['oname'].":</strong>".tep_draw_pull_down_menu('id['.$attributes[$o]['oid'].']',array_values($attributes[$o]['ovals']),$attributes[$o]['default'], "onchange="stkmsg(this.form);"")."</p>n";
}
$out.=$this->_draw_out_of_stock_message_js($attributes);
return $out;
}
}
?>