Version Notes
Stable release
Download this release
Release Info
| Developer | Développeurs EnvoiMoinsCher.com |
| Extension | orange_latestproducts |
| Version | 0.1.0 |
| Comparing to | |
| See all releases | |
Version 0.1.0
- app/code/community/Orange/LatestProducts/Model/Latestproducts.php +36 -0
- app/code/community/Orange/LatestProducts/etc/config.xml +54 -0
- app/code/community/Orange/LatestProducts/etc/system.xml +81 -0
- app/design/frontend/base/default/layout/orange_latestproducts.xml +11 -0
- app/design/frontend/base/default/template/orange/latestproducts/latestproducts.phtml +51 -0
- app/etc/modules/Orange_LatestProducts.xml +9 -0
- package.xml +18 -0
app/code/community/Orange/LatestProducts/Model/Latestproducts.php
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Orange_Latestproducts_Model_Latestproducts extends Mage_Core_Model_Abstract
|
| 3 |
+
{
|
| 4 |
+
function getStoreData($item)
|
| 5 |
+
{
|
| 6 |
+
return Mage::getStoreConfig('orange_latestproducts/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 |
+
->addAttributeToFilter('visibility', array('neq' => 1))
|
| 31 |
+
->addAttributeToSelect('*')
|
| 32 |
+
->setOrder('created_at', 'desc')
|
| 33 |
+
->setPageSize($_limit);
|
| 34 |
+
return $_productCollection;
|
| 35 |
+
}
|
| 36 |
+
}
|
app/code/community/Orange/LatestProducts/etc/config.xml
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Orange_LatestProducts>
|
| 5 |
+
<version>0.1.0</version>
|
| 6 |
+
</Orange_LatestProducts>
|
| 7 |
+
</modules>
|
| 8 |
+
<frontend>
|
| 9 |
+
<layout>
|
| 10 |
+
<updates>
|
| 11 |
+
<orange>
|
| 12 |
+
<file>orange_latestproducts.xml</file>
|
| 13 |
+
</orange>
|
| 14 |
+
</updates>
|
| 15 |
+
</layout>
|
| 16 |
+
</frontend>
|
| 17 |
+
<global>
|
| 18 |
+
<models>
|
| 19 |
+
<orange_latestproducts>
|
| 20 |
+
<class>Orange_Latestproducts_Model</class>
|
| 21 |
+
</orange_latestproducts>
|
| 22 |
+
</models>
|
| 23 |
+
</global>
|
| 24 |
+
<adminhtml>
|
| 25 |
+
<acl>
|
| 26 |
+
<resources>
|
| 27 |
+
<admin>
|
| 28 |
+
<children>
|
| 29 |
+
<system>
|
| 30 |
+
<children>
|
| 31 |
+
<config>
|
| 32 |
+
<children>
|
| 33 |
+
<orange_latestproducts/>
|
| 34 |
+
</children>
|
| 35 |
+
</config>
|
| 36 |
+
</children>
|
| 37 |
+
</system>
|
| 38 |
+
</children>
|
| 39 |
+
</admin>
|
| 40 |
+
</resources>
|
| 41 |
+
</acl>
|
| 42 |
+
</adminhtml>
|
| 43 |
+
<default>
|
| 44 |
+
<orange_latestproducts>
|
| 45 |
+
<settings>
|
| 46 |
+
<enable>1</enable>
|
| 47 |
+
<show_title>1</show_title>
|
| 48 |
+
<block_title>Latest Products</block_title>
|
| 49 |
+
<display_products>3</display_products>
|
| 50 |
+
<addtocart>1</addtocart>
|
| 51 |
+
</settings>
|
| 52 |
+
</orange_latestproducts>
|
| 53 |
+
</default>
|
| 54 |
+
</config>
|
app/code/community/Orange/LatestProducts/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>150</sort_order>
|
| 7 |
+
</orange>
|
| 8 |
+
</tabs>
|
| 9 |
+
<sections>
|
| 10 |
+
<orange_latestproducts translate="label">
|
| 11 |
+
<label>Latest Products</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_latestproducts>
|
| 80 |
+
</sections>
|
| 81 |
+
</config>
|
app/design/frontend/base/default/layout/orange_latestproducts.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/latestproducts/latestproducts.phtml"/>
|
| 6 |
+
</reference>
|
| 7 |
+
<reference name="left">
|
| 8 |
+
<block type="catalog/product_send" name="orange_bestsellers" template="orange/latestproducts/latestproducts.phtml"/>
|
| 9 |
+
</reference>
|
| 10 |
+
</default>
|
| 11 |
+
</layout>
|
app/design/frontend/base/default/template/orange/latestproducts/latestproducts.phtml
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
$_latestproducts = Mage::getModel('orange_latestproducts/latestproducts');
|
| 3 |
+
$_helper = $this->helper('catalog/output');
|
| 4 |
+
?>
|
| 5 |
+
<?php if($_latestproducts->isActive()): ?>
|
| 6 |
+
<div class="block">
|
| 7 |
+
<?php if($_latestproducts->showTitle()): ?>
|
| 8 |
+
<div class="block-title">
|
| 9 |
+
<strong>
|
| 10 |
+
<span><?php echo $_latestproducts->getTitle() ?></span>
|
| 11 |
+
</strong>
|
| 12 |
+
</div>
|
| 13 |
+
<?php endif ?>
|
| 14 |
+
<div class="block-content">
|
| 15 |
+
<?php if($_latestproducts->data() && count($_latestproducts->data())): ?>
|
| 16 |
+
<ol class="mini-products-list">
|
| 17 |
+
<?php foreach ($_latestproducts->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($_latestproducts->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_LatestProducts.xml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Orange_LatestProducts>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>community</codePool>
|
| 7 |
+
</Orange_LatestProducts>
|
| 8 |
+
</modules>
|
| 9 |
+
</config>
|
package.xml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>orange_latestproducts</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 Latest products</summary>
|
| 10 |
+
<description>Magento Latest products module automatically generates the list of your latest 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-12</date>
|
| 14 |
+
<time>21:20:43</time>
|
| 15 |
+
<contents><target name="magecommunity"><dir name="Orange"><dir name="LatestProducts"><dir name="Model"><file name="Latestproducts.php" hash="bafb9b8ad530b43d8662f673139ee79d"/></dir><dir name="etc"><file name="config.xml" hash="457ff88ca4365e8f4a7f881974e0ab8c"/><file name="system.xml" hash="68852551be0ac354874bbb029254bf1a"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="orange"><dir name="latestproducts"><file name="latestproducts.phtml" hash="268af3635c8303078d42c995ede84c5d"/></dir></dir></dir><dir name="layout"><file name="orange_latestproducts.xml" hash="6bfcacac17034c51c9152117da61c8b8"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Orange_LatestProducts.xml" hash="58322bbf143b1edf902a0b444f59da28"/></dir></target></contents>
|
| 16 |
+
<compatible/>
|
| 17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
| 18 |
+
</package>
|
