Version Notes
Stable release
Download this release
Release Info
| Developer | Développeurs EnvoiMoinsCher.com |
| Extension | orange_bestsellers |
| Version | 0.1.0 |
| Comparing to | |
| See all releases | |
Version 0.1.0
- app/code/community/Orange/Bestsellers/Model/Bestsellers.php +36 -0
- app/code/community/Orange/Bestsellers/etc/config.xml +54 -0
- app/code/community/Orange/Bestsellers/etc/system.xml +81 -0
- app/design/frontend/base/default/layout/orange_bestsellers.xml +11 -0
- app/design/frontend/base/default/template/orange/bestsellers/bestsellers.phtml +51 -0
- app/etc/modules/Orange_Bestsellers.xml +9 -0
- package.xml +18 -0
app/code/community/Orange/Bestsellers/Model/Bestsellers.php
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Orange_Bestsellers_Model_Bestsellers extends Mage_Core_Model_Abstract
|
| 3 |
+
{
|
| 4 |
+
function getStoreData($item)
|
| 5 |
+
{
|
| 6 |
+
return Mage::getStoreConfig('orange_bestsellers/settings/' . $item);
|
| 7 |
+
}
|
| 8 |
+
public function showTitle()
|
| 9 |
+
{
|
| 10 |
+
return $this->getStoreData('show_title');
|
| 11 |
+
}
|
| 12 |
+
public function getTitle()
|
| 13 |
+
{
|
| 14 |
+
return $this->getStoreData('block_title');
|
| 15 |
+
}
|
| 16 |
+
public function isActive()
|
| 17 |
+
{
|
| 18 |
+
return $this->getStoreData('enable');
|
| 19 |
+
}
|
| 20 |
+
public function addToCart()
|
| 21 |
+
{
|
| 22 |
+
return $this->getStoreData('addtocart');
|
| 23 |
+
}
|
| 24 |
+
public function data()
|
| 25 |
+
{
|
| 26 |
+
$_limit = $this->getStoreData('display_products');
|
| 27 |
+
if($_limit < 1)
|
| 28 |
+
$_limit = 0;
|
| 29 |
+
$_productCollection = Mage::getResourceModel('reports/product_collection')
|
| 30 |
+
->addAttributeToSelect('*')
|
| 31 |
+
->addOrderedQty()
|
| 32 |
+
->setOrder('ordered_qty','desc')
|
| 33 |
+
->setPageSize($_limit);
|
| 34 |
+
return $_productCollection;
|
| 35 |
+
}
|
| 36 |
+
}
|
app/code/community/Orange/Bestsellers/etc/config.xml
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Orange_Bestsellers>
|
| 5 |
+
<version>0.1.0</version>
|
| 6 |
+
</Orange_Bestsellers>
|
| 7 |
+
</modules>
|
| 8 |
+
<frontend>
|
| 9 |
+
<layout>
|
| 10 |
+
<updates>
|
| 11 |
+
<orange_bestsellers>
|
| 12 |
+
<file>orange_bestsellers.xml</file>
|
| 13 |
+
</orange_bestsellers>
|
| 14 |
+
</updates>
|
| 15 |
+
</layout>
|
| 16 |
+
</frontend>
|
| 17 |
+
<global>
|
| 18 |
+
<models>
|
| 19 |
+
<orange_bestsellers>
|
| 20 |
+
<class>Orange_Bestsellers_Model</class>
|
| 21 |
+
</orange_bestsellers>
|
| 22 |
+
</models>
|
| 23 |
+
</global>
|
| 24 |
+
<adminhtml>
|
| 25 |
+
<acl>
|
| 26 |
+
<resources>
|
| 27 |
+
<admin>
|
| 28 |
+
<children>
|
| 29 |
+
<system>
|
| 30 |
+
<children>
|
| 31 |
+
<config>
|
| 32 |
+
<children>
|
| 33 |
+
<orange_bestsellers/>
|
| 34 |
+
</children>
|
| 35 |
+
</config>
|
| 36 |
+
</children>
|
| 37 |
+
</system>
|
| 38 |
+
</children>
|
| 39 |
+
</admin>
|
| 40 |
+
</resources>
|
| 41 |
+
</acl>
|
| 42 |
+
</adminhtml>
|
| 43 |
+
<default>
|
| 44 |
+
<orange_bestsellers>
|
| 45 |
+
<settings>
|
| 46 |
+
<enable>1</enable>
|
| 47 |
+
<show_title>1</show_title>
|
| 48 |
+
<block_title>Bestsellers</block_title>
|
| 49 |
+
<display_products>3</display_products>
|
| 50 |
+
<addtocart>1</addtocart>
|
| 51 |
+
</settings>
|
| 52 |
+
</orange_bestsellers>
|
| 53 |
+
</default>
|
| 54 |
+
</config>
|
app/code/community/Orange/Bestsellers/etc/system.xml
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<tabs>
|
| 4 |
+
<orange translate="label">
|
| 5 |
+
<label>orange</label>
|
| 6 |
+
<sort_order>120</sort_order>
|
| 7 |
+
</orange>
|
| 8 |
+
</tabs>
|
| 9 |
+
<sections>
|
| 10 |
+
<orange_bestsellers translate="label">
|
| 11 |
+
<label>Bestsellers</label>
|
| 12 |
+
<tab>orange</tab>
|
| 13 |
+
<frontend_type>text</frontend_type>
|
| 14 |
+
<sort_order>1</sort_order>
|
| 15 |
+
<show_in_default>1</show_in_default>
|
| 16 |
+
<show_in_website>1</show_in_website>
|
| 17 |
+
<show_in_store>1</show_in_store>
|
| 18 |
+
<groups>
|
| 19 |
+
<settings translate="label">
|
| 20 |
+
<label>Settings</label>
|
| 21 |
+
<frontend_type>text</frontend_type>
|
| 22 |
+
<sort_order>1</sort_order>
|
| 23 |
+
<show_in_default>1</show_in_default>
|
| 24 |
+
<show_in_website>1</show_in_website>
|
| 25 |
+
<show_in_store>1</show_in_store>
|
| 26 |
+
<fields>
|
| 27 |
+
<enable translate="label">
|
| 28 |
+
<label>Enable</label>
|
| 29 |
+
<frontend_type>select</frontend_type>
|
| 30 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 31 |
+
<sort_order>1</sort_order>
|
| 32 |
+
<show_in_default>1</show_in_default>
|
| 33 |
+
<show_in_website>1</show_in_website>
|
| 34 |
+
<show_in_store>1</show_in_store>
|
| 35 |
+
</enable>
|
| 36 |
+
<show_title translate="label">
|
| 37 |
+
<label>Show title</label>
|
| 38 |
+
<frontend_type>select</frontend_type>
|
| 39 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 40 |
+
<sort_order>2</sort_order>
|
| 41 |
+
<show_in_default>1</show_in_default>
|
| 42 |
+
<show_in_website>1</show_in_website>
|
| 43 |
+
<show_in_store>1</show_in_store>
|
| 44 |
+
</show_title>
|
| 45 |
+
<block_title translate="label">
|
| 46 |
+
<label>Block title</label>
|
| 47 |
+
<depends>
|
| 48 |
+
<show_title>1</show_title>
|
| 49 |
+
</depends>
|
| 50 |
+
<validate>validate-one-required</validate>
|
| 51 |
+
<frontend_type>text</frontend_type>
|
| 52 |
+
<sort_order>3</sort_order>
|
| 53 |
+
<show_in_default>1</show_in_default>
|
| 54 |
+
<show_in_website>1</show_in_website>
|
| 55 |
+
<show_in_store>1</show_in_store>
|
| 56 |
+
</block_title>
|
| 57 |
+
<display_products translate="label">
|
| 58 |
+
<label>Display products</label>
|
| 59 |
+
<comment>0 - no limit</comment>
|
| 60 |
+
<frontend_type>text</frontend_type>
|
| 61 |
+
<validate>validate-number validate-one-required</validate>
|
| 62 |
+
<sort_order>4</sort_order>
|
| 63 |
+
<show_in_default>1</show_in_default>
|
| 64 |
+
<show_in_website>1</show_in_website>
|
| 65 |
+
<show_in_store>1</show_in_store>
|
| 66 |
+
</display_products>
|
| 67 |
+
<addtocart translate="label">
|
| 68 |
+
<label>Show Add To Cart button</label>
|
| 69 |
+
<frontend_type>select</frontend_type>
|
| 70 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 71 |
+
<sort_order>5</sort_order>
|
| 72 |
+
<show_in_default>1</show_in_default>
|
| 73 |
+
<show_in_website>1</show_in_website>
|
| 74 |
+
<show_in_store>1</show_in_store>
|
| 75 |
+
</addtocart>
|
| 76 |
+
</fields>
|
| 77 |
+
</settings>
|
| 78 |
+
</groups>
|
| 79 |
+
</orange_bestsellers>
|
| 80 |
+
</sections>
|
| 81 |
+
</config>
|
app/design/frontend/base/default/layout/orange_bestsellers.xml
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<layout version="0.1.0">
|
| 3 |
+
<default>
|
| 4 |
+
<reference name="right">
|
| 5 |
+
<block type="catalog/product_send" name="orange_bestsellers" template="orange/bestsellers/bestsellers.phtml"/>
|
| 6 |
+
</reference>
|
| 7 |
+
<reference name="left">
|
| 8 |
+
<block type="catalog/product_send" name="orange_bestsellers" template="orange/bestsellers/bestsellers.phtml"/>
|
| 9 |
+
</reference>
|
| 10 |
+
</default>
|
| 11 |
+
</layout>
|
app/design/frontend/base/default/template/orange/bestsellers/bestsellers.phtml
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
$_bestsellers = Mage::getModel('orange_bestsellers/bestsellers');
|
| 3 |
+
$_helper = $this->helper('catalog/output');
|
| 4 |
+
?>
|
| 5 |
+
<?php if($_bestsellers->isActive()): ?>
|
| 6 |
+
<div class="block">
|
| 7 |
+
<?php if($_bestsellers->showTitle()): ?>
|
| 8 |
+
<div class="block-title">
|
| 9 |
+
<strong>
|
| 10 |
+
<span><?php echo $_bestsellers->getTitle() ?></span>
|
| 11 |
+
</strong>
|
| 12 |
+
</div>
|
| 13 |
+
<?php endif ?>
|
| 14 |
+
<div class="block-content">
|
| 15 |
+
<?php if($_bestsellers->data() && count($_bestsellers->data())): ?>
|
| 16 |
+
<ol class="mini-products-list">
|
| 17 |
+
<?php foreach ($_bestsellers->data() as $_product): ?>
|
| 18 |
+
<?php $_product = Mage::getModel('catalog/product')->load($_product->getId()) ?>
|
| 19 |
+
<li class="item">
|
| 20 |
+
<div class="product">
|
| 21 |
+
<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(50); ?>" width="50" height="50" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
|
| 22 |
+
<div class="product-details">
|
| 23 |
+
<p 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></p>
|
| 24 |
+
<?php echo $this->getPriceHtml($_product, true) ?>
|
| 25 |
+
<?php if($_bestsellers->addToCart()): ?>
|
| 26 |
+
<?php if($_product->isSaleable()): ?>
|
| 27 |
+
<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>
|
| 28 |
+
<?php else: ?>
|
| 29 |
+
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
|
| 30 |
+
<?php endif; ?>
|
| 31 |
+
<?php endif ?>
|
| 32 |
+
<ul class="add-to-links">
|
| 33 |
+
<?php if ($this->helper('wishlist')->isAllow()) : ?>
|
| 34 |
+
<li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
|
| 35 |
+
<?php endif; ?>
|
| 36 |
+
<?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
|
| 37 |
+
<li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
|
| 38 |
+
<?php endif; ?>
|
| 39 |
+
</ul>
|
| 40 |
+
</div>
|
| 41 |
+
</div>
|
| 42 |
+
</li>
|
| 43 |
+
<?php endforeach ?>
|
| 44 |
+
</ol>
|
| 45 |
+
<script type="text/javascript">decorateGeneric($$('li.item'), ['odd','even','first','last'])</script>
|
| 46 |
+
<?php else: ?>
|
| 47 |
+
<p class="empty">No products found.</p>
|
| 48 |
+
<?php endif ?>
|
| 49 |
+
</div>
|
| 50 |
+
</div>
|
| 51 |
+
<?php endif ?>
|
app/etc/modules/Orange_Bestsellers.xml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Orange_Bestsellers>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>community</codePool>
|
| 7 |
+
</Orange_Bestsellers>
|
| 8 |
+
</modules>
|
| 9 |
+
</config>
|
package.xml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>orange_bestsellers</name>
|
| 4 |
+
<version>0.1.0</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license>Open Software License</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>Display Bestsellers products</summary>
|
| 10 |
+
<description>Magento Bestsellers module automatically generates the list of your online store's best selling products.</description>
|
| 11 |
+
<notes>Stable release</notes>
|
| 12 |
+
<authors><author><name>Mage</name><user>Dev</user><email>mage.ext@gmail.com</email></author></authors>
|
| 13 |
+
<date>2013-01-10</date>
|
| 14 |
+
<time>14:05:23</time>
|
| 15 |
+
<contents><target name="magecommunity"><dir name="Orange"><dir name="Bestsellers"><dir name="Model"><file name="Bestsellers.php" hash="8f403e82b6268431d37a7b3b9a1e49b9"/></dir><dir name="etc"><file name="config.xml" hash="e656c0d60dbbdfc86ea68ac2338e746b"/><file name="system.xml" hash="8333ecc9a2c3f667e1dd01ed5ba86579"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="orange"><dir name="bestsellers"><file name="bestsellers.phtml" hash="04e80744562906390b3083c35f7d8a5c"/></dir></dir></dir><dir name="layout"><file name="orange_bestsellers.xml" hash="ae2cc5a442b6efae19627bab11746fc0"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Orange_Bestsellers.xml" hash="396d6d0b972577b89acf6c437a3e54e3"/></dir></target></contents>
|
| 16 |
+
<compatible/>
|
| 17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
| 18 |
+
</package>
|
