Hi,
I've used the options of single product to create a free shipping value, for me work.
Create an RADIO option called "shipping" (or so on) then add a value called "free". This is the option to free shipping for a single product. Well, add this option to all product that you want free shipping (Important: this option must be REQUIRED to work properly!).
Add some little change to the code of your shipping method, for example I use the flat method, so i've changed the model/shipping/flat.php file:
Add:
Code: Select all
$free_shipping = 0;
$total_products = count($this->cart->getProducts());
foreach($this->cart->getProducts() as $product) {
foreach($product['option'] as $option) {
if($option['option_value'] == 'free') {
$free_shipping++;
}
}
}
$shipping_cost = $this->config->get('flat_cost');
if($free_shipping == $total_products) { /*If ALL products are free shipping set cost 0 else add shipping cost*/
$shipping_cost = 0;
}
Change:
Code: Select all
$quote_data['flat'] = array(
'code' => 'flat.flat',
'title' => $this->language->get('text_title'),
'cost' => $shipping_cost,
'tax_class_id' => $this->config->get('flat_tax_class_id'),
'text' => $this->currency->format($this->tax->calculate($shipping_cost, $this->config->get('flat_tax_class_id'), $this->config->get('config_tax')))
);
If you want you can change product.tpl to show an image of free shipping like this:
Code: Select all
<?php if ($option['type'] == 'radio') { ?>
<div id="option-<?php echo $option['product_option_id']; ?>" class="option">
<!-- Free shipping - Start -->
<?php if ($option['name'] == 'shipping') { ?>
<?php foreach ($option['option_value'] as $option_value) { ?>
<?php if($option_value['name'] == 'free') { ?>
<img src="MY FREE SHIPPING IMAGE URL" alt="Free Shipping" />
<input type="radio" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option_value['product_option_value_id']; ?>" id="option-value-<?php echo $option_value['product_option_value_id']; ?>" checked style="display: none;" />
<?php } ?>
<?php } ?>
<?php } else { ?>
<!-- Free shipping - End -->
<?php if ($option['required']) { ?>
<span class="required">*</span>
<?php } ?>
<b><?php echo $option['name']; ?>:</b><br />
<?php foreach ($option['option_value'] as $option_value) { ?>
<input type="radio" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option_value['product_option_value_id']; ?>" id="option-value-<?php echo $option_value['product_option_value_id']; ?>" />
<label for="option-value-<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>
<?php if ($option_value['price']) { ?>
(<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
<?php } ?>
</label>
<br />
<?php } ?>
<?php } ?><!-- End else -->
</div>
<br />
<?php } ?><!-- End radio Option -->
In same way you can change feature module or so on...
For now i've not find bug, please report a issue if you find.