News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

dropdown quantity box missing in vm 2.0.8

Started by pablo.egido, July 05, 2012, 18:51:00 PM

Previous topic - Next topic

pablo.egido

Hi,
In olds VM i had the option in List Products - display options -> "Drop Down Box Values" in quantity. Now i have the VM 2.0 and I have a problem, I'm trying to find this option but I not find it.
Is possible that is missing?

Anyone could help me? Thanks and regards.

PRO

this is not an option in 2.0 as of right now

pablo.egido


pablo.egido

Hi,
I solved my problem writing a litte bit of code:

first, I do a little fudge: i use 3 fields to do it: in product-> product status.
min_order_level - > the minimum value
max_order_level -> the maximul value
low_stock_notification -> the interval (how much I want to increase)

In my case, the interval must be float because I need decimals. Then I change it with phpmyadmin in the database.

second, I go to the file where I list the products and change it. (.\components\com_virtuemart\views\category\tmpl\default.php)

I comment the two original lines. (are more or less in the 310 line)

<span class="quantity-box">
  <?php            
//<input type="text" class="quantity-input" name="quantity[]" value="1" />
//<label></label>

$code = '';
$code = '<select class="inputboxquantity" id="quantity'.$prod_id.'" name="quantity[]">';
$inicial = 0;
$final = 50;
$intervalo = 1;

if ($product->min_order_level > 0){
$inicial = $product->min_order_level;
}
if ($product->max_order_level > 0){
$final = $product->max_order_level;
}
if ($product->low_stock_notification > 0){
$intervalo = $product->low_stock_notification;
}

      for($i=$inicial;$i<$final;$i += $intervalo) {
         $code .= '  <option value="'.$i.'"';
         if ($i == 5) {
            $code .= ' selected="selected"';
         }
         $code .= '>'.$i."</option>\n";
      }
      $code .= "</select>\n";
      echo $code
?>

</span>

and all is working fine. Regards.

pablo.egido

I do it too in: (.\components\com_virtuemart\views\productdetails\tmpl\default_addtocart.php)

the difference is that you must use: $this->product->min_order_level and not $product->min_order_level

$code = '';
$code = '<select class="inputboxquantity" id="quantity'.$prod_id.'" name="quantity[]">';
$inicial = 0;
$final = 50;
$intervalo = 1;

if ($this->product->min_order_level > 0){
$inicial = $this->product->min_order_level;
}
if ($this->product->max_order_level > 0){
$final = $this->product->max_order_level;
}
if ($this->product->low_stock_notification > 0){
$intervalo = $this->product->low_stock_notification;
}

      for($i=$inicial;$i<$final;$i += $intervalo) {
         $code .= '  <option value="'.$i.'"';
         if ($i == $intervalo) {
            $code .= ' selected="selected"';
         }
         $code .= '>'.$i."</option>\n";
      }
      $code .= "</select>\n";
      echo $code;

regards

stavroch

I am using the v. 2.0.14 and I can't find the above instructions that you described.
How can I have drop down box instead of text box in quantity field?