Version Notes
First realesed
Download this release
Release Info
Developer | Hardik |
Extension | hkproductoption |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/local/HK/Customoption/Helper/Data.php +5 -0
- app/code/local/HK/Customoption/etc/config.xml +38 -0
- app/design/frontend/base/default/layout/customoption.xml +25 -0
- app/design/frontend/base/default/template/customoption/index.phtml +128 -0
- app/etc/modules/HK_Customoption.xml +10 -0
- package.xml +18 -0
app/code/local/HK/Customoption/Helper/Data.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class HK_Customoption_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
}
|
5 |
+
|
app/code/local/HK/Customoption/etc/config.xml
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<HK_Customoption>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</HK_Customoption>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<customoption>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>HK_Customoption</module>
|
14 |
+
<frontName>customoption</frontName>
|
15 |
+
</args>
|
16 |
+
</customoption>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<customoption>
|
21 |
+
<file>customoption.xml</file>
|
22 |
+
</customoption>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<global>
|
27 |
+
<helpers>
|
28 |
+
<customoption>
|
29 |
+
<class>HK_Customoption_Helper</class>
|
30 |
+
</customoption>
|
31 |
+
</helpers>
|
32 |
+
<blocks>
|
33 |
+
<customoption>
|
34 |
+
<class>HK_Customoption_Block</class>
|
35 |
+
</customoption>
|
36 |
+
</blocks>
|
37 |
+
</global>
|
38 |
+
</config>
|
app/design/frontend/base/default/layout/customoption.xml
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
|
4 |
+
<!-- <customoption_index_index>
|
5 |
+
<reference name="root">
|
6 |
+
<action method="setTemplate"><template>page/1column.phtml</template></action>
|
7 |
+
</reference>
|
8 |
+
<reference name="content">
|
9 |
+
<block type="customoption/index" name="customoption_index" template="customoption/index.phtml"/>
|
10 |
+
</reference>
|
11 |
+
</customoption_index_index> -->
|
12 |
+
|
13 |
+
|
14 |
+
<catalog_category_layered translate="label">
|
15 |
+
|
16 |
+
<reference name="product_list">
|
17 |
+
<action method="setTemplate">
|
18 |
+
<template>customoption/index.phtml</template>
|
19 |
+
</action>
|
20 |
+
</reference>
|
21 |
+
|
22 |
+
|
23 |
+
</catalog_category_layered>
|
24 |
+
</layout>
|
25 |
+
|
app/design/frontend/base/default/template/customoption/index.phtml
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$_productCollection=$this->getLoadedProductCollection();
|
3 |
+
$_helper = $this->helper('catalog/output');
|
4 |
+
?>
|
5 |
+
<?php if(!$_productCollection->count()): ?>
|
6 |
+
<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
|
7 |
+
<?php else: ?>
|
8 |
+
<div class="category-products">
|
9 |
+
<?php echo $this->getToolbarHtml() ?>
|
10 |
+
<?php // List mode ?>
|
11 |
+
<?php if($this->getMode()!='grid'): ?>
|
12 |
+
<?php $_iterator = 0; ?>
|
13 |
+
<ol class="products-list" id="products-list">
|
14 |
+
<?php foreach ($_productCollection as $_product): ?>
|
15 |
+
<li class="item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
|
16 |
+
<?php // Product Image ?>
|
17 |
+
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
|
18 |
+
<?php // Product description ?>
|
19 |
+
<div class="product-shop">
|
20 |
+
<div class="f-fix">
|
21 |
+
<?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
|
22 |
+
<h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></a></h2>
|
23 |
+
<?php if($_product->getRatingSummary()): ?>
|
24 |
+
<?php echo $this->getReviewsSummaryHtml($_product) ?>
|
25 |
+
<?php endif; ?>
|
26 |
+
<?php echo $this->getPriceHtml($_product, true) ?>
|
27 |
+
<?php if($_product->isSaleable()): ?>
|
28 |
+
<p><button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>
|
29 |
+
<?php else: ?>
|
30 |
+
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
|
31 |
+
<?php endif; ?>
|
32 |
+
<div class="desc std">
|
33 |
+
<?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
|
34 |
+
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped ?>" class="link-learn"><?php echo $this->__('Learn More') ?></a>
|
35 |
+
</div>
|
36 |
+
<ul class="add-to-links">
|
37 |
+
<?php if ($this->helper('wishlist')->isAllow()) : ?>
|
38 |
+
<li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
|
39 |
+
<?php endif; ?>
|
40 |
+
<?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
|
41 |
+
<li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
|
42 |
+
<?php endif; ?>
|
43 |
+
</ul>
|
44 |
+
</div>
|
45 |
+
</div>
|
46 |
+
</li>
|
47 |
+
<?php endforeach; ?>
|
48 |
+
</ol>
|
49 |
+
<script type="text/javascript">decorateList('products-list', 'none-recursive')</script>
|
50 |
+
|
51 |
+
<?php else: ?>
|
52 |
+
|
53 |
+
<?php // Grid Mode ?>
|
54 |
+
|
55 |
+
<?php $_collectionSize = $_productCollection->count() ?>
|
56 |
+
<?php $_columnCount = $this->getColumnCount(); ?>
|
57 |
+
<?php $i=0; foreach ($_productCollection as $_product): ?>
|
58 |
+
|
59 |
+
<?php
|
60 |
+
$productSku = $_product->getSku();
|
61 |
+
$product = Mage::getModel('catalog/product');
|
62 |
+
$productId = $product->getIdBySku( $productSku );
|
63 |
+
$product = Mage::getModel("catalog/product")->load($productId);
|
64 |
+
$attVal = $product->getOptions();
|
65 |
+
$optStr = "";
|
66 |
+
?>
|
67 |
+
|
68 |
+
<?php if ($i++%$_columnCount==0): ?>
|
69 |
+
<ul class="products-grid">
|
70 |
+
<?php endif ?>
|
71 |
+
<li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
|
72 |
+
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
|
73 |
+
<h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></h2>
|
74 |
+
<?php if($_product->getRatingSummary()): ?>
|
75 |
+
<?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
|
76 |
+
<?php endif; ?>
|
77 |
+
<?php echo $this->getPriceHtml($_product, true) ?>
|
78 |
+
<div class="actions">
|
79 |
+
<?php if($_product->isSaleable()):?>
|
80 |
+
<form action="<?php echo $this->helper('checkout/cart')->getAddUrl($_product)?>" method="post" id= "product_addtocart_form" <?php if($_product->getOptions()):?> enctype="multipart/form-data"<?php endif;?>>
|
81 |
+
<div style='float: left; width: 100px;'>
|
82 |
+
<?php foreach($attVal as $optionKey => $optionVal)
|
83 |
+
{
|
84 |
+
$optStr.= "<select style='display:block; clear:both;' name='options[".$optionVal->getId()."]'>"; foreach($optionVal->getValues() as $valuesKey => $valuesVal)
|
85 |
+
{
|
86 |
+
$optStr.= "<option value='".$valuesVal->getId()."'>".$valuesVal->getTitle()."</option>";
|
87 |
+
}
|
88 |
+
$optStr.= "</select>";
|
89 |
+
}
|
90 |
+
echo($optStr );?>
|
91 |
+
|
92 |
+
<!--Replace "buttonImage.png" with any button image in your skin images -->
|
93 |
+
<input type="image" value="Add to cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product)?>')" style="background: none repeat scroll 0px 0px rgb(241, 130, 0); border: 1px solid rgb(222, 84, 0); color: rgb(255, 255, 255); height: 19px; text-align: center; white-space: nowrap; width: 65px; font: bold 12px/19px Arial,Helvetica,sans-serif; padding: 1px 8px;">
|
94 |
+
</div>
|
95 |
+
<?php else:?>
|
96 |
+
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock')?></span></p>
|
97 |
+
<?php endif;?>
|
98 |
+
<ul class="add-to-links">
|
99 |
+
<?php if ($this->helper('wishlist')->isAllow()) :?>
|
100 |
+
<li>
|
101 |
+
<a href="<?php echo $this->helper('wishlist')->getAddUrl($_product)?>" class="link-wishlist">
|
102 |
+
<?php echo $this->__('Add to Wishlist')?>
|
103 |
+
</a>
|
104 |
+
</li>
|
105 |
+
<?php endif;?>
|
106 |
+
<?php if($_compareUrl=$this->getAddToCompareUrl($_product)):?>
|
107 |
+
<li>
|
108 |
+
<span class="separator">|</span>
|
109 |
+
<a href="<?php echo $_compareUrl?>" class="link-compare"><?php echo $this->__('Add to Compare')?>
|
110 |
+
</a>
|
111 |
+
</li>
|
112 |
+
<?php endif;?>
|
113 |
+
</ul>
|
114 |
+
</form>
|
115 |
+
</div>
|
116 |
+
</li>
|
117 |
+
<?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
|
118 |
+
</ul>
|
119 |
+
<?php endif ?>
|
120 |
+
<?php endforeach ?>
|
121 |
+
<script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
|
122 |
+
<?php endif; ?>
|
123 |
+
|
124 |
+
<div class="toolbar-bottom">
|
125 |
+
<?php echo $this->getToolbarHtml() ?>
|
126 |
+
</div>
|
127 |
+
</div>
|
128 |
+
<?php endif; ?>
|
app/etc/modules/HK_Customoption.xml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<HK_Customoption>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
<version>0.1.0</version>
|
8 |
+
</HK_Customoption>
|
9 |
+
</modules>
|
10 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>hkproductoption</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OLS v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Custom option on product list page.</summary>
|
10 |
+
<description>Now you can display your product custom option on product list page. Also you can add your product direct from list page with selected custom option.</description>
|
11 |
+
<notes>First realesed</notes>
|
12 |
+
<authors><author><name>Hardik</name><user>khpatel201</user><email>hkpatel201@gmail.com</email></author></authors>
|
13 |
+
<date>2014-05-12</date>
|
14 |
+
<time>12:16:35</time>
|
15 |
+
<contents><target name="magelocal"><dir name="HK"><dir name="Customoption"><dir name="Helper"><file name="Data.php" hash="cc3422ad60cb708471da7901b4484612"/></dir><dir name="etc"><file name="config.xml" hash="391a253a65ce75cc4fb3cc6c388bce36"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="customoption.xml" hash="fc53465e39a0632691ad8d5a4ab5cb47"/></dir><dir name="template"><dir name="customoption"><file name="index.phtml" hash="0857b1eee0a924b4eb1cef61f7fbd823"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="HK_Customoption.xml" hash="05f73078c797d3f7579809e63c77d329"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|