Skip to content

Instantly share code, notes, and snippets.

View rsangeethk's full-sized avatar
🚀
Building

Sangeeth Kannan rsangeethk

🚀
Building
View GitHub Profile
@rsangeethk
rsangeethk / opencart_option_image
Created September 30, 2013 08:34
Add Image to Option(checkbox) Opencart
<!--Add to catalog/view/theme/your-theme/template/product/product.tpl-->
<!--Find the line: "<?php if ($option['type'] == 'checkbox') { ?>" in line 117(may vary)-->
<!-- the next line-->
<!--Replace <div id="option-<?php echo $option['product_option_id']; ?>" class="option">
<?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="checkbox" 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']; ?>" />
@rsangeethk
rsangeethk / variation_table
Created September 6, 2013 07:24
Woocommerce Display all Variations as table
//Display variation dropdown as table
function woocommerce_variable_add_to_cart() {
global $product, $post;
$variations = $product->get_available_variations();
foreach ($variations as $key => $value) {
?>
<form action="<?php echo esc_url( $product->add_to_cart_url() ); ?>"method="post" enctype='multipart/form-data'>
<input type="hidden" name="variation_id" value="<?php echo $value['variation_id']?>" />
<input type="hidden" name="product_id" value="<?php echo esc_attr( $post->ID ); ?>" />
<?php