This here could be an alternative, at least for the Product Page!
I have 'cleaned out' the VqMod a little, and tested it in my Test OC v.2.2.0.0
as you can see here:
http://www.bigmax.ch/oc22/index.php?rou ... duct_id=43
Link the category Add-to-Cart BUTTON to directly access the Product Page, and let them
add products only from the Product Page, it would be much less work to do!
Ernie
---
Links:
http://forum.opencart.com/viewtopic.php ... 67#p604967
---
jb_quantity_selector.xml VqMod, free, as tested on my OC v.2.2.0.0:
the MAX-Product Stock is automatically the MAX-Drop-Down Display-Value, visible,
and if a Minimum Quantity exists, this Value will be shown as such on the first button.
---
Code: Select all
<modification>
<id>VQMOD Easy Quantity Selector with Settings</id>
<version>OC v.2.2.x</version>
<vqmver>2.6.1</vqmver>
<author>jericbas- cleaned by IP_CAM</author>
<file name="admin/language/*/setting/setting.php">
<operation error="log">
<search position="after"><![CDATA[$_['entry_status']]]></search>
<add><![CDATA[
$_['entry_jbqty_number_of_button'] = 'Number of Quantity selector buttons';
$_['entry_jbqty_button_css_style'] = 'Quantity selector CSS';
]]></add>
</operation>
</file>
<file name="admin/controller/setting/setting.php">
<operation error="log">
<search position="after"><![CDATA[$data['entry_status'] = $this->language->get('entry_status');]]></search>
<add><![CDATA[
$data['entry_jbqty_number_of_button'] = $this->language->get('entry_jbqty_number_of_button');
$data['entry_jbqty_button_css_style'] = $this->language->get('entry_jbqty_button_css_style');
]]></add>
</operation>
<operation error="log">
<search position="before" ><![CDATA[if (isset($this->request->post['config_review_status'])) {]]></search>
<add><![CDATA[
if (empty($this->config->get('config_jbqty_number_of_button'))) {
$this->config->set('config_jbqty_number_of_button',5);
$data['config_jbqty_number_of_button'] = $this->config->get('config_jbqty_number_of_button');
}
if (isset($this->request->post['config_jbqty_number_of_button'])) {
$data['config_jbqty_number_of_button'] = $this->request->post['config_jbqty_number_of_button'];
} else {$data['config_jbqty_number_of_button'] = $this->config->get('config_jbqty_number_of_button');}
if (empty($this->config->get('config_jbqty_button_css_style'))) {
$this->config->set('config_jbqty_button_css_style','.jb-btn-circle {
width: 30px;
height: 30px;
text-align: center;
padding: 6px 0;
font-size: 12px;
line-height: 1.428571429;
border-radius: 15px;
}');
}
if (isset($this->request->post['config_jbqty_button_css_style'])) {
$data['config_jbqty_button_css_style'] = $this->request->post['config_jbqty_button_css_style'];
} else {
$data['config_jbqty_button_css_style'] = $this->config->get('config_jbqty_button_css_style');
}
]]></add>
</operation>
</file>
<file name="admin/view/template/setting/setting.tpl">
<operation error="log">
<search position="before" offset="2"><![CDATA[<legend><?php echo $text_review; ?></legend>]]></search>
<add><![CDATA[
<div class="form-group">
<label class="col-sm-2 control-label" ><?php echo $entry_jbqty_number_of_button?></label>
<div class="col-sm-10">
<input type="text" name="config_jbqty_number_of_button" value="<?php echo $config_jbqty_number_of_button; ?>" placeholder="<?php echo $entry_jbqty_number_of_button; ?>" class="form-control" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" ><?php echo $entry_jbqty_button_css_style?></label>
<div class="col-sm-10">
<textarea name="config_jbqty_button_css_style" rows="15" placeholder="<?php echo $entry_jbqty_button_css_style; ?>" class="form-control"><?php echo $config_jbqty_button_css_style; ?></textarea>
</div>
</div>
]]></add>
</operation>
</file>
<file name="catalog/controller/product/product.php">
<operation error="log">
<search position="after" offset="2"><![CDATA[$data['minimum'] = 1;]]></search>
<add><![CDATA[
$data['config_jbqty_number_of_button'] = $this->config->get('config_jbqty_number_of_button');
$data['config_jbqty_button_css_style'] = $this->config->get('config_jbqty_button_css_style');
if ($product_info['quantity']) {
$data['quantity'] = $product_info['quantity'];
} else {
$data['quantity'] = $data['minimum'] ;
}
]]></add>
</operation>
</file>
<file name="catalog/view/theme/*/template/product/product.tpl">
<operation error="log">
<search position="after"><![CDATA[<input type="text" name="quantity" value="<?php echo $minimum; ?>" size="2" id="input-quantity" class="form-control" />]]></search>
<add><![CDATA[
<style><?php
if(empty($config_jbqty_button_css_style)){ ?>
.jb-btn-circle {
width: 30px;
height: 30px;
text-align: center;
padding: 6px 0;
font-size: 12px;
line-height: 1.428571429;
border-radius: 15px;
} <?php } else {
echo $config_jbqty_button_css_style;
} ?>
</style>
<div class="jb-btn-circles">
<?php
$jbLimit = 5;
if(!empty($config_jbqty_number_of_button)){
$jbLimit = $config_jbqty_number_of_button;
}
$jb_ctr=0;
for($x=$minimum;$x<=$quantity;++$x){ ?>
<button type="button" class="btn btn-default jb-btn-circle<?php if($jb_ctr==0){ echo ' active';}?>" value="<?php echo $x;?>"><?php echo $x;?></button>
<?php
--$jbLimit;
if($jbLimit==1){ ?>
<button type="button" class="btn btn-default jb-btn-circle jb-hide-circles" value="<?php echo $x+1;?>"><?php echo $x+1;?>+</button>
<?php break;
}
++$jb_ctr;
} ?>
<select id="jb-select-quantity" class="form-control" style="display:none;">
<?php for($x=$minimum;$x<=$quantity;++$x){ ?>
<option value="<?php echo $x;?>"><?php echo $x;?></option>
<?php } ?>
</select>
</div>
<script>
$(function(){$("#input-quantity,#jb-select-quantity").hide(),$("#jb-select-quantity").hide(),$(".jb-btn-circle").on("click",function(){$(".jb-btn-circle").removeClass("active"),$(this).hasClass("jb-hide-circles")?($(".jb-btn-circle").hide(),$("#jb-select-quantity").show(),$("#jb-select-quantity").val($(this).val())):($("#input-quantity").val($(this).val()),$(this).addClass("active"))}),$("#jb-select-quantity").on("keyup change",function(){$("#input-quantity").val($("#jb-select-quantity").val())})});
</script>
]]></add>
</operation>
</file>
</modification>
---