Version Notes
- Ajax loader of additional products on Product Page
- Load products from specific category
- Load products from last child category
- Easily replace Related Products, Up-sell Products, Most Viewed Products functionalities
- Load additional products with scroll down
- Load additional products on a click of a button
- Option to set Header Name
- Option to set Number of items per one step
- Option to Enable/Disable extension
- Option to set Load Action (either Scroll or Button)
- Option to Enable/Disable loading of Additional Products functionality on Specific Product Pages
Download this release
Release Info
| Developer | MKMage |
| Extension | auto_related_products |
| Version | 0.1.0 |
| Comparing to | |
| See all releases | |
Version 0.1.0
- app/code/local/MKMage/.DS_Store +0 -0
- app/code/local/MKMage/LoadMoreProducts/Block/Info.php +20 -0
- app/code/local/MKMage/LoadMoreProducts/Helper/Data.php +15 -0
- app/code/local/MKMage/LoadMoreProducts/Model/.DS_Store +0 -0
- app/code/local/MKMage/LoadMoreProducts/Model/Observer.php +46 -0
- app/code/local/MKMage/LoadMoreProducts/Model/Select/.DS_Store +0 -0
- app/code/local/MKMage/LoadMoreProducts/Model/Select/Select.php +26 -0
- app/code/local/MKMage/LoadMoreProducts/controllers/IndexController.php +37 -0
- app/code/local/MKMage/LoadMoreProducts/etc/adminhtml.xml +0 -0
- app/code/local/MKMage/LoadMoreProducts/etc/config.xml +85 -0
- app/code/local/MKMage/LoadMoreProducts/etc/system.xml +160 -0
- app/code/local/MKMage/LoadMoreProducts/sql/loadmore_setup/mysql4-install-0.1.0.php +23 -0
- app/code/local/MKMage/Mkcore/Block/Mkcore.php +5 -0
- app/code/local/MKMage/Mkcore/Helper/Data.php +5 -0
- app/code/local/MKMage/Mkcore/etc/config.xml +43 -0
- app/code/local/MKMage/Mkcore/etc/system.xml +12 -0
- app/design/frontend/base/default/layout/mkmage/.DS_Store +0 -0
- app/design/frontend/base/default/layout/mkmage/loadmore.xml +17 -0
- app/design/frontend/base/default/template/mkmage/.DS_Store +0 -0
- app/design/frontend/base/default/template/mkmage/loadmore/definition.phtml +82 -0
- app/design/frontend/base/default/template/mkmage/loadmore/loadmore.phtml +20 -0
- app/etc/modules/MKMage_LoadMoreProducts.xml +8 -0
- app/etc/modules/MKMage_Mkcore.xml +9 -0
- js/mkmage/loadmore/loadmore.js +65 -0
- package.xml +28 -0
- skin/adminhtml/default/default/mkcore.png +0 -0
- skin/frontend/base/default/images/mkmage/loadmore/loading_icon.gif +0 -0
app/code/local/MKMage/.DS_Store
ADDED
|
Binary file
|
app/code/local/MKMage/LoadMoreProducts/Block/Info.php
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class MKMage_LoadMoreProducts_Block_Info
|
| 4 |
+
extends Mage_Adminhtml_Block_Abstract
|
| 5 |
+
implements Varien_Data_Form_Element_Renderer_Interface
|
| 6 |
+
{
|
| 7 |
+
|
| 8 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
| 9 |
+
{
|
| 10 |
+
$version = '';
|
| 11 |
+
$html = <<<HTML
|
| 12 |
+
<div style="border:1px solid #ccc; margin:5px 0; padding:30px;">
|
| 13 |
+
<p>
|
| 14 |
+
This extension requires "product_additional_data" block to be used on Product Page.
|
| 15 |
+
</p>
|
| 16 |
+
</div>
|
| 17 |
+
HTML;
|
| 18 |
+
return $html;
|
| 19 |
+
}
|
| 20 |
+
}
|
app/code/local/MKMage/LoadMoreProducts/Helper/Data.php
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class MKMage_LoadMoreProducts_Helper_Data extends Mage_Core_Helper_Abstract
|
| 3 |
+
{
|
| 4 |
+
|
| 5 |
+
public function getIsActive() {
|
| 6 |
+
|
| 7 |
+
$loadMoreXmlEnabled = Mage::helper('core')->isModuleEnabled('MKMage_LoadMoreProducts') ? true : false;
|
| 8 |
+
$loadMoreOutputEnabled = Mage::helper('core')->isModuleOutputEnabled("MKMage_LoadMoreProducts") ? true : false;
|
| 9 |
+
$loadMoreModuleEnabled = Mage::getStoreConfig('loadmoreproducts/loadmoreproducts_enable/loadmoreproducts_enabled',Mage::app()->getStore()) ? true : false;
|
| 10 |
+
|
| 11 |
+
return ( $loadMoreXmlEnabled && $loadMoreOutputEnabled && $loadMoreModuleEnabled ) ? true : false;
|
| 12 |
+
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
}
|
app/code/local/MKMage/LoadMoreProducts/Model/.DS_Store
ADDED
|
Binary file
|
app/code/local/MKMage/LoadMoreProducts/Model/Observer.php
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class MKMage_LoadMoreProducts_Model_Observer {
|
| 4 |
+
|
| 5 |
+
public function validateSystemSettings(Varien_Event_Observer $observer) {
|
| 6 |
+
|
| 7 |
+
if (Mage::getStoreConfig('loadmoreproducts/loadmoreproducts_enable/email') != '') {
|
| 8 |
+
|
| 9 |
+
if (Mage::getStoreConfig('loadmoreproducts/loadmoreproducts_enable/email_sent') != 1) {
|
| 10 |
+
|
| 11 |
+
$body = '<p>Load More Products registration for ' . Mage::getBaseUrl() . '</p>';
|
| 12 |
+
|
| 13 |
+
$email = Mage::getModel('core/email');
|
| 14 |
+
$email->setToName('MkMage');
|
| 15 |
+
$email->setToEmail('igor@mkmage.com');
|
| 16 |
+
$email->setBody($body);
|
| 17 |
+
$email->setSubject('Load More Products Customer Registration');
|
| 18 |
+
$email->setFromEmail(Mage::getStoreConfig('loadmoreproducts/loadmoreproducts_enable/email'));
|
| 19 |
+
$email->setFromName(Mage::getBaseUrl());
|
| 20 |
+
$email->setType('html');
|
| 21 |
+
|
| 22 |
+
try {
|
| 23 |
+
$email->send();
|
| 24 |
+
Mage::getSingleton('core/session')->addSuccess('Thank you for registering with us.');
|
| 25 |
+
}
|
| 26 |
+
catch (Exception $e) {
|
| 27 |
+
Zend_Debug::dump($e->getMessage());
|
| 28 |
+
Mage::getSingleton('core/session')->addError('Could not proccess your request.');
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
Mage::getConfig()->saveConfig('loadmoreproducts/loadmoreproducts_enable/email_sent', 1);
|
| 32 |
+
Mage::getConfig()->saveConfig('loadmoreproducts/loadmoreproducts_enable/loadmoreproducts_enabled', 1);
|
| 33 |
+
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
} else {
|
| 37 |
+
|
| 38 |
+
Mage::getConfig()->saveConfig('loadmoreproducts/loadmoreproducts_enable/loadmoreproducts_enabled', 0);
|
| 39 |
+
Mage::getConfig()->saveConfig('loadmoreproducts/loadmoreproducts_enable/email_sent', 0);
|
| 40 |
+
Mage::getSingleton('core/session')->addWarning('Please enter email address to register the extension.');
|
| 41 |
+
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
}
|
app/code/local/MKMage/LoadMoreProducts/Model/Select/.DS_Store
ADDED
|
Binary file
|
app/code/local/MKMage/LoadMoreProducts/Model/Select/Select.php
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* @author MKMage
|
| 4 |
+
* @copyright Copyright (c) 2016 MKMage
|
| 5 |
+
*/
|
| 6 |
+
|
| 7 |
+
class MKMage_LoadMoreProducts_Model_Select_Select extends Mage_Core_Model_Abstract{
|
| 8 |
+
|
| 9 |
+
public function _construct()
|
| 10 |
+
{
|
| 11 |
+
parent::_construct();
|
| 12 |
+
$this->_init('loadmoreproducts/select_select');
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
public function toOptionArray($default = false){
|
| 16 |
+
$options = array(
|
| 17 |
+
array('value' => 'button' , 'label' => Mage::helper('loadmoreproducts')->__('Button')),
|
| 18 |
+
array('value' => 'scroll' , 'label' => Mage::helper('loadmoreproducts')->__('Scroll')),
|
| 19 |
+
|
| 20 |
+
);
|
| 21 |
+
|
| 22 |
+
return $options;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
}
|
| 26 |
+
?>
|
app/code/local/MKMage/LoadMoreProducts/controllers/IndexController.php
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class MKMage_LoadMoreProducts_IndexController extends Mage_Core_Controller_Front_Action {
|
| 3 |
+
|
| 4 |
+
public function indexAction() {
|
| 5 |
+
|
| 6 |
+
$attrs = Mage::app()->getRequest()->getPost();
|
| 7 |
+
$page = $attrs['page'];
|
| 8 |
+
$product_current_category = $attrs['category'];
|
| 9 |
+
$item_per_load = $attrs['item_per_load'];
|
| 10 |
+
|
| 11 |
+
$products = Mage::getModel('catalog/category')->load($product_current_category)
|
| 12 |
+
->getProductCollection()
|
| 13 |
+
->addAttributeToSelect('*') // add all attributes - optional
|
| 14 |
+
->addAttributeToFilter('status', 1) // enabled
|
| 15 |
+
->addFieldToFilter('visibility', 4) //visibility in catalog,search
|
| 16 |
+
->setPageSize($item_per_load)
|
| 17 |
+
->setOrder('ordered_qty', 'desc')
|
| 18 |
+
->setCurPage($page); //sets the order by price
|
| 19 |
+
|
| 20 |
+
$size = $products->getSize();
|
| 21 |
+
|
| 22 |
+
if ($item_per_load * $page >= $size) {
|
| 23 |
+
$endCollection = true;
|
| 24 |
+
} else {
|
| 25 |
+
$endCollection = false;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
$block = $this->getLayout()->createBlock('core/template')->setTemplate('mkmage/loadmore/loadmore.phtml');
|
| 29 |
+
$block->setData('loadCollection', $products);
|
| 30 |
+
$block->setData('endCollection', $endCollection);
|
| 31 |
+
|
| 32 |
+
echo $block->toHtml();
|
| 33 |
+
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
}
|
| 37 |
+
|
app/code/local/MKMage/LoadMoreProducts/etc/adminhtml.xml
ADDED
|
File without changes
|
app/code/local/MKMage/LoadMoreProducts/etc/config.xml
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<config>
|
| 2 |
+
<modules>
|
| 3 |
+
<MKMage_LoadMoreProducts>
|
| 4 |
+
<version>0.1.0</version>
|
| 5 |
+
</MKMage_LoadMoreProducts>
|
| 6 |
+
</modules>
|
| 7 |
+
<frontend>
|
| 8 |
+
|
| 9 |
+
<routers>
|
| 10 |
+
<loadmoreproducts>
|
| 11 |
+
<use>standard</use>
|
| 12 |
+
<args>
|
| 13 |
+
<module>MKMage_LoadMoreProducts</module>
|
| 14 |
+
<frontName>loadmore</frontName>
|
| 15 |
+
</args>
|
| 16 |
+
</loadmoreproducts>
|
| 17 |
+
</routers>
|
| 18 |
+
<layout>
|
| 19 |
+
<updates>
|
| 20 |
+
<loadmoreproducts>
|
| 21 |
+
<file>mkmage/loadmore.xml</file>
|
| 22 |
+
</loadmoreproducts>
|
| 23 |
+
</updates>
|
| 24 |
+
</layout>
|
| 25 |
+
</frontend>
|
| 26 |
+
<global>
|
| 27 |
+
<events>
|
| 28 |
+
<admin_system_config_changed_section_loadmoreproducts>
|
| 29 |
+
<observers>
|
| 30 |
+
<loadmoreproducts>
|
| 31 |
+
<type>singleton</type>
|
| 32 |
+
<class>MKMage_LoadMoreProducts_Model_Observer</class>
|
| 33 |
+
<method>validateSystemSettings</method>
|
| 34 |
+
</loadmoreproducts>
|
| 35 |
+
</observers>
|
| 36 |
+
</admin_system_config_changed_section_loadmoreproducts>
|
| 37 |
+
</events>
|
| 38 |
+
<blocks>
|
| 39 |
+
<loadmoreproducts>
|
| 40 |
+
<class>MKMage_LoadMoreProducts_Block</class>
|
| 41 |
+
</loadmoreproducts>
|
| 42 |
+
</blocks>
|
| 43 |
+
<models>
|
| 44 |
+
<loadmoreproducts>
|
| 45 |
+
<class>MKMage_LoadMoreProducts_Model</class>
|
| 46 |
+
</loadmoreproducts>
|
| 47 |
+
</models>
|
| 48 |
+
<helpers>
|
| 49 |
+
<loadmoreproducts>
|
| 50 |
+
<class>MKMage_LoadMoreProducts_Helper</class>
|
| 51 |
+
</loadmoreproducts>
|
| 52 |
+
</helpers>
|
| 53 |
+
<resources>
|
| 54 |
+
<loadmore_setup>
|
| 55 |
+
<setup>
|
| 56 |
+
<module>MKMage_LoadMoreProducts</module>
|
| 57 |
+
</setup>
|
| 58 |
+
</loadmore_setup>
|
| 59 |
+
</resources>
|
| 60 |
+
</global>
|
| 61 |
+
<adminhtml>
|
| 62 |
+
<acl>
|
| 63 |
+
<resources>
|
| 64 |
+
<all>
|
| 65 |
+
<title>Allow Everything</title>
|
| 66 |
+
</all>
|
| 67 |
+
<admin>
|
| 68 |
+
<children>
|
| 69 |
+
<system>
|
| 70 |
+
<children>
|
| 71 |
+
<config>
|
| 72 |
+
<children>
|
| 73 |
+
<loadmoreproducts>
|
| 74 |
+
<title>Inchoo - All</title>
|
| 75 |
+
</loadmoreproducts>
|
| 76 |
+
</children>
|
| 77 |
+
</config>
|
| 78 |
+
</children>
|
| 79 |
+
</system>
|
| 80 |
+
</children>
|
| 81 |
+
</admin>
|
| 82 |
+
</resources>
|
| 83 |
+
</acl>
|
| 84 |
+
</adminhtml>
|
| 85 |
+
</config>
|
app/code/local/MKMage/LoadMoreProducts/etc/system.xml
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<config>
|
| 3 |
+
<tabs>
|
| 4 |
+
<mkmage translate="label" module="loadmoreproducts">
|
| 5 |
+
<label>MKMage Extensions</label>
|
| 6 |
+
<sort_order>100</sort_order>
|
| 7 |
+
</mkmage>
|
| 8 |
+
</tabs>
|
| 9 |
+
<sections>
|
| 10 |
+
|
| 11 |
+
<loadmoreproducts translate="label" module="loadmoreproducts">
|
| 12 |
+
<label>Load more products</label>
|
| 13 |
+
<tab>mkmage</tab>
|
| 14 |
+
<sort_order>200</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 |
+
<about translate="label">
|
| 20 |
+
<label>Info</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 |
+
<info translate="label">
|
| 28 |
+
<frontend_model>loadmoreproducts/info</frontend_model>
|
| 29 |
+
<sort_order>1</sort_order>
|
| 30 |
+
<show_in_default>1</show_in_default>
|
| 31 |
+
<show_in_website>1</show_in_website>
|
| 32 |
+
<show_in_store>1</show_in_store>
|
| 33 |
+
</info>
|
| 34 |
+
</fields>
|
| 35 |
+
</about>
|
| 36 |
+
<loadmoreproducts_enable translate="label" module="loadmoreproducts">
|
| 37 |
+
<label>Enable Extension</label>
|
| 38 |
+
<frontend_type>text</frontend_type>
|
| 39 |
+
<sort_order>1000</sort_order>
|
| 40 |
+
<comment>
|
| 41 |
+
<![CDATA[
|
| 42 |
+
<style>#row_loadmoreproducts_loadmoreproducts_enable_email_sent{display:none;}</style>
|
| 43 |
+
]]>
|
| 44 |
+
</comment>
|
| 45 |
+
<show_in_default>1</show_in_default>
|
| 46 |
+
<show_in_website>1</show_in_website>
|
| 47 |
+
<show_in_store>1</show_in_store>
|
| 48 |
+
<fields>
|
| 49 |
+
|
| 50 |
+
<email translate="label">
|
| 51 |
+
<label>Register extension</label>
|
| 52 |
+
<frontend_type>text</frontend_type>
|
| 53 |
+
<validate>validate-email</validate>
|
| 54 |
+
<comment>Enter email to register your extension</comment>
|
| 55 |
+
<!--<backend_model>adminhtml/system_config_backend_email_address</backend_model>-->
|
| 56 |
+
<sort_order>1</sort_order>
|
| 57 |
+
<show_in_default>1</show_in_default>
|
| 58 |
+
<show_in_website>1</show_in_website>
|
| 59 |
+
<show_in_store>1</show_in_store>
|
| 60 |
+
</email>
|
| 61 |
+
<email_sent translate="label">
|
| 62 |
+
<frontend_type>hidden</frontend_type>
|
| 63 |
+
<sort_order>2</sort_order>
|
| 64 |
+
<show_in_default>1</show_in_default>
|
| 65 |
+
<show_in_website>1</show_in_website>
|
| 66 |
+
<show_in_store>1</show_in_store>
|
| 67 |
+
</email_sent>
|
| 68 |
+
<loadmoreproducts_enabled translate="label">
|
| 69 |
+
<label>Enable</label>
|
| 70 |
+
<frontend_type>select</frontend_type>
|
| 71 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 72 |
+
<sort_order>3</sort_order>
|
| 73 |
+
<show_in_default>1</show_in_default>
|
| 74 |
+
<show_in_website>1</show_in_website>
|
| 75 |
+
<show_in_store>1</show_in_store>
|
| 76 |
+
</loadmoreproducts_enabled>
|
| 77 |
+
</fields>
|
| 78 |
+
</loadmoreproducts_enable>
|
| 79 |
+
|
| 80 |
+
<loadmoreproducts_info translate="label" module="loadmoreproducts">
|
| 81 |
+
<label>Display Information</label>
|
| 82 |
+
<frontend_type>text</frontend_type>
|
| 83 |
+
<sort_order>2000</sort_order>
|
| 84 |
+
<show_in_default>1</show_in_default>
|
| 85 |
+
<show_in_website>1</show_in_website>
|
| 86 |
+
<show_in_store>1</show_in_store>
|
| 87 |
+
<fields>
|
| 88 |
+
<loadmoreproducts_input translate="label">
|
| 89 |
+
<label>Header Name: </label>
|
| 90 |
+
<comment>Ajax products Title (ex. You might also like)</comment>
|
| 91 |
+
<frontend_type>text</frontend_type>
|
| 92 |
+
<sort_order>20</sort_order>
|
| 93 |
+
<show_in_default>1</show_in_default>
|
| 94 |
+
<show_in_website>1</show_in_website>
|
| 95 |
+
<show_in_store>1</show_in_store>
|
| 96 |
+
</loadmoreproducts_input>
|
| 97 |
+
<loadmoreproducts_speps translate="label">
|
| 98 |
+
<label>Number of steps: </label>
|
| 99 |
+
<comment>(default: 2; max-steps: 10;)</comment>
|
| 100 |
+
<frontend_type>text</frontend_type>
|
| 101 |
+
<sort_order>25</sort_order>
|
| 102 |
+
<show_in_default>1</show_in_default>
|
| 103 |
+
<show_in_website>1</show_in_website>
|
| 104 |
+
<show_in_store>1</show_in_store>
|
| 105 |
+
</loadmoreproducts_speps>
|
| 106 |
+
<loadmoreproducts_on_load translate="label">
|
| 107 |
+
<label>Number of items per one step: </label>
|
| 108 |
+
<comment>Display number of products per one step (default: 4)</comment>
|
| 109 |
+
<frontend_type>text</frontend_type>
|
| 110 |
+
<sort_order>30</sort_order>
|
| 111 |
+
<show_in_default>1</show_in_default>
|
| 112 |
+
<show_in_website>1</show_in_website>
|
| 113 |
+
<show_in_store>1</show_in_store>
|
| 114 |
+
</loadmoreproducts_on_load>
|
| 115 |
+
<loadmoreproducts_load_type translate="label">
|
| 116 |
+
<label>Loading Action: </label>
|
| 117 |
+
<comment>Load more products by click on "Button" or "Scroll" to end of page</comment>
|
| 118 |
+
<frontend_type>select</frontend_type>
|
| 119 |
+
<source_model>loadmoreproducts/select_select</source_model>
|
| 120 |
+
<sort_order>35</sort_order>
|
| 121 |
+
<show_in_default>1</show_in_default>
|
| 122 |
+
<show_in_website>1</show_in_website>
|
| 123 |
+
<show_in_store>1</show_in_store>
|
| 124 |
+
</loadmoreproducts_load_type>
|
| 125 |
+
</fields>
|
| 126 |
+
</loadmoreproducts_info>
|
| 127 |
+
|
| 128 |
+
<loadmoreproducts_info2 translate="label" module="loadmoreproducts">
|
| 129 |
+
<label>Specific Category</label>
|
| 130 |
+
<frontend_type>text</frontend_type>
|
| 131 |
+
<sort_order>3000</sort_order>
|
| 132 |
+
<show_in_default>1</show_in_default>
|
| 133 |
+
<show_in_website>1</show_in_website>
|
| 134 |
+
<show_in_store>1</show_in_store>
|
| 135 |
+
<fields>
|
| 136 |
+
<loadmoreproducts_enabled_2 translate="label">
|
| 137 |
+
<label>Enable this solution</label>
|
| 138 |
+
<frontend_type>select</frontend_type>
|
| 139 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 140 |
+
<sort_order>1</sort_order>
|
| 141 |
+
<show_in_default>1</show_in_default>
|
| 142 |
+
<show_in_website>1</show_in_website>
|
| 143 |
+
<show_in_store>1</show_in_store>
|
| 144 |
+
</loadmoreproducts_enabled_2>
|
| 145 |
+
<loadmoreproducts_input2 translate="label">
|
| 146 |
+
<label>#ID of specific category: </label>
|
| 147 |
+
<comment>Ajax load additional products form this specific category. (if empty, load additional product from Product Parent Category)</comment>
|
| 148 |
+
<frontend_type>text</frontend_type>
|
| 149 |
+
<sort_order>20</sort_order>
|
| 150 |
+
<show_in_default>1</show_in_default>
|
| 151 |
+
<show_in_website>1</show_in_website>
|
| 152 |
+
<show_in_store>1</show_in_store>
|
| 153 |
+
</loadmoreproducts_input2>
|
| 154 |
+
</fields>
|
| 155 |
+
</loadmoreproducts_info2>
|
| 156 |
+
|
| 157 |
+
</groups>
|
| 158 |
+
</loadmoreproducts>
|
| 159 |
+
</sections>
|
| 160 |
+
</config>
|
app/code/local/MKMage/LoadMoreProducts/sql/loadmore_setup/mysql4-install-0.1.0.php
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
$installer = $this;
|
| 4 |
+
|
| 5 |
+
$installer->startSetup();
|
| 6 |
+
|
| 7 |
+
$attributeInstaller = new Mage_Eav_Model_Entity_Setup('core_setup');
|
| 8 |
+
$attributeInstaller->removeAttribute('catalog_product','mkmage_loadmore_check');
|
| 9 |
+
$attributeInstaller->addAttribute('catalog_product', "mkmage_loadmore_check", array(
|
| 10 |
+
'group' => 'MKMage Loadmore',
|
| 11 |
+
'label' => 'Disable loading on additional products',
|
| 12 |
+
'sort_order' => 50,
|
| 13 |
+
'type' => 'int',
|
| 14 |
+
'source' => 'eav/entity_attribute_source_boolean',
|
| 15 |
+
'input' => 'boolean',
|
| 16 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
|
| 17 |
+
'visible' => true,
|
| 18 |
+
'required' => false,
|
| 19 |
+
'user_defined' => true,
|
| 20 |
+
));
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
$installer->endSetup();
|
app/code/local/MKMage/Mkcore/Block/Mkcore.php
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class MKMage_Mkcore_Block_Mkcore extends Mage_Core_Block_Template
|
| 3 |
+
{
|
| 4 |
+
|
| 5 |
+
}
|
app/code/local/MKMage/Mkcore/Helper/Data.php
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class MKMage_Mkcore_Helper_Data extends Mage_Core_Helper_Data
|
| 3 |
+
{
|
| 4 |
+
|
| 5 |
+
}
|
app/code/local/MKMage/Mkcore/etc/config.xml
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<config>
|
| 2 |
+
<modules>
|
| 3 |
+
<MKMage_Mkcore>
|
| 4 |
+
<version>0.1.0</version>
|
| 5 |
+
</MKMage_Mkcore>
|
| 6 |
+
</modules>
|
| 7 |
+
<global>
|
| 8 |
+
<blocks>
|
| 9 |
+
<mkcore>
|
| 10 |
+
<class>MKMage_Mkcore_Block</class>
|
| 11 |
+
</mkcore>
|
| 12 |
+
</blocks>
|
| 13 |
+
<helpers>
|
| 14 |
+
<mkcore>
|
| 15 |
+
<class>MKMage_Mkcore_Helper</class>
|
| 16 |
+
</mkcore>
|
| 17 |
+
</helpers>
|
| 18 |
+
</global>
|
| 19 |
+
<adminhtml>
|
| 20 |
+
<acl>
|
| 21 |
+
<resources>
|
| 22 |
+
<all>
|
| 23 |
+
<title>Allow Everything</title>
|
| 24 |
+
</all>
|
| 25 |
+
<admin>
|
| 26 |
+
<children>
|
| 27 |
+
<system>
|
| 28 |
+
<children>
|
| 29 |
+
<config>
|
| 30 |
+
<children>
|
| 31 |
+
<mkmage>
|
| 32 |
+
<title>MKMage - All</title>
|
| 33 |
+
</mkmage>
|
| 34 |
+
</children>
|
| 35 |
+
</config>
|
| 36 |
+
</children>
|
| 37 |
+
</system>
|
| 38 |
+
</children>
|
| 39 |
+
</admin>
|
| 40 |
+
</resources>
|
| 41 |
+
</acl>
|
| 42 |
+
</adminhtml>
|
| 43 |
+
</config>
|
app/code/local/MKMage/Mkcore/etc/system.xml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<config>
|
| 3 |
+
<tabs>
|
| 4 |
+
<mkmage translate="label" module="mkcore">
|
| 5 |
+
<label><![CDATA[<div style="position: absolute;"><img id="mkmage_block" src="" alt="" border="0" /></div> <script>
|
| 6 |
+
var n = SKIN_URL.indexOf("adminhtml");
|
| 7 |
+
$('mkmage_block').src = SKIN_URL.substring(0, n) + "/adminhtml/default/default/mkcore.png";
|
| 8 |
+
</script>]]></label>
|
| 9 |
+
<sort_order>100</sort_order>
|
| 10 |
+
</mkmage>
|
| 11 |
+
</tabs>
|
| 12 |
+
</config>
|
app/design/frontend/base/default/layout/mkmage/.DS_Store
ADDED
|
Binary file
|
app/design/frontend/base/default/layout/mkmage/loadmore.xml
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<layout version="0.1.0">
|
| 3 |
+
<default>
|
| 4 |
+
<reference name="head">
|
| 5 |
+
<action method="addItem">
|
| 6 |
+
<type>js</type>
|
| 7 |
+
<name>mkmage/loadmore/loadmore.js</name>
|
| 8 |
+
<params><![CDATA[data-group="js002"]]></params>
|
| 9 |
+
</action>
|
| 10 |
+
</reference>
|
| 11 |
+
</default>
|
| 12 |
+
<catalog_product_view>
|
| 13 |
+
<reference name="product.info.additional" >
|
| 14 |
+
<block type="core/template" name="loadmore" template="mkmage/loadmore/definition.phtml" />
|
| 15 |
+
</reference>
|
| 16 |
+
</catalog_product_view>
|
| 17 |
+
</layout>
|
app/design/frontend/base/default/template/mkmage/.DS_Store
ADDED
|
Binary file
|
app/design/frontend/base/default/template/mkmage/loadmore/definition.phtml
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<style> .button_holder {width:100%; float:left; clear:both;} .mkmage_loadmore {text-align:center; } .load_buttom { width: 200px;text-align: center;float: none;display: inline-block;background: #3399CC;color: white;cursor: pointer; margin-top:30px;} #loadmore { width: 100%;}#loadmore li {width:25%;float:left;}#loadingicon { clear: both;float: none;margin: auto;position: relative;top: 50%;left: 50%;margin-left: -20px;}.loadmore_title {color: black;border-bottom: 1px solid gray;text-align: center;font-size: 20px;}</style>
|
| 2 |
+
<?php
|
| 3 |
+
$check_enabled = Mage::getStoreConfig('loadmoreproducts/loadmoreproducts_enable/loadmoreproducts_enabled',Mage::app()->getStore());
|
| 4 |
+
$tittle_name = Mage::getStoreConfig('loadmoreproducts/loadmoreproducts_info/loadmoreproducts_input',Mage::app()->getStore());
|
| 5 |
+
$check_spesific_id = Mage::getStoreConfig('loadmoreproducts/loadmoreproducts_info2/loadmoreproducts_enabled_2',Mage::app()->getStore());
|
| 6 |
+
$get_spesific_id = Mage::getStoreConfig('loadmoreproducts/loadmoreproducts_info2/loadmoreproducts_input2',Mage::app()->getStore());
|
| 7 |
+
$get_on_pageload = Mage::getStoreConfig('loadmoreproducts/loadmoreproducts_info/loadmoreproducts_on_load',Mage::app()->getStore());
|
| 8 |
+
$num_spetps = Mage::getStoreConfig('loadmoreproducts/loadmoreproducts_info/loadmoreproducts_speps',Mage::app()->getStore());
|
| 9 |
+
$type_of_load = Mage::getStoreConfig('loadmoreproducts/loadmoreproducts_info/loadmoreproducts_load_type',Mage::app()->getStore());
|
| 10 |
+
|
| 11 |
+
$_product = Mage::registry('current_product');
|
| 12 |
+
$check_availability_product = $_product->getData('mkmage_loadmore_check');
|
| 13 |
+
|
| 14 |
+
if ($check_enabled == 1 && $check_availability_product != 1 ) {
|
| 15 |
+
|
| 16 |
+
if (!empty($tittle_name)): ?>
|
| 17 |
+
<p class="loadmore_title"><?php echo $tittle_name; ?></p>
|
| 18 |
+
<?php else: ?>
|
| 19 |
+
<p class="loadmore_title">You might also like</p>
|
| 20 |
+
<?php endif; ?>
|
| 21 |
+
<?php
|
| 22 |
+
$categories = $_product->getCategoryIds();
|
| 23 |
+
$parent_category = end($categories);
|
| 24 |
+
|
| 25 |
+
if ($check_spesific_id == 1 && !empty($get_spesific_id) ) {
|
| 26 |
+
$get_subcat = $get_spesific_id;
|
| 27 |
+
} else {
|
| 28 |
+
$get_subcat = $parent_category;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
if (!empty($get_on_pageload) && $get_on_pageload > 0 && $get_on_pageload <= 10 ) {
|
| 32 |
+
$load_items = $get_on_pageload;
|
| 33 |
+
} else {
|
| 34 |
+
$load_items = 4;
|
| 35 |
+
}
|
| 36 |
+
if ($num_spetps > 2 && $num_spetps <= 10 ) {
|
| 37 |
+
$num_spetps = $num_spetps;
|
| 38 |
+
} else {
|
| 39 |
+
$num_spetps = 2;
|
| 40 |
+
}
|
| 41 |
+
//var_dump($get_subcat); die();
|
| 42 |
+
$cat_name = Mage::getModel('catalog/category')->load($get_subcat)->getName();
|
| 43 |
+
?>
|
| 44 |
+
|
| 45 |
+
<?php
|
| 46 |
+
$products = Mage::getModel('catalog/category')->load($get_subcat)
|
| 47 |
+
->getProductCollection()
|
| 48 |
+
->addAttributeToSelect('*') // add all attributes - optional
|
| 49 |
+
->addAttributeToFilter('status', 1) // enabled
|
| 50 |
+
->addAttributeToFilter('visibility', 4) //visibility in catalog,search
|
| 51 |
+
->setPageSize($load_items) //sets only 4 per page
|
| 52 |
+
->setOrder('ordered_qty', 'desc');
|
| 53 |
+
?>
|
| 54 |
+
<div class="mkmage_loadmore">
|
| 55 |
+
<input type="hidden" value="2" id="page_num" >
|
| 56 |
+
<input type="hidden" id="product_id_ajax" value="<?php echo $_product->getId() ?>" />
|
| 57 |
+
<input type="hidden" id="loadmore_ajax" value="<?php echo Mage::getBaseUrl() . 'loadmore' ?>" />
|
| 58 |
+
<input type="hidden" id="subcat_ajax" value="<?php echo $get_subcat; ?>" />
|
| 59 |
+
<input type="hidden" id="item_per_load" value="<?php echo $load_items; ?>" />
|
| 60 |
+
<input type="hidden" id="num_spetps" value="<?php echo $num_spetps + 1; ?>" />
|
| 61 |
+
<input type="hidden" id="type_of_load" value="<?php echo $type_of_load; ?>" />
|
| 62 |
+
<ul id="loadmore">
|
| 63 |
+
<?php foreach ($products as $product): ?>
|
| 64 |
+
|
| 65 |
+
<li>
|
| 66 |
+
<?php $prod = Mage::getModel('catalog/product')->load($product->getId()); ?>
|
| 67 |
+
<a href="<?php echo $prod->getProductUrl(); ?>" >
|
| 68 |
+
<img src="<?php echo Mage::helper('catalog/image')->init($prod, 'image')->resize(290,290); ?> "/>
|
| 69 |
+
<span class="search_name">
|
| 70 |
+
<?php echo $prod->getName(); ?>
|
| 71 |
+
</span>
|
| 72 |
+
</a>
|
| 73 |
+
</li>
|
| 74 |
+
|
| 75 |
+
<?php endforeach; ?>
|
| 76 |
+
</ul>
|
| 77 |
+
<img id="loadingicon" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?>frontend/base/default/images/mkmage/loadmore/loading_icon.gif" style="width:40px; display:none;" />
|
| 78 |
+
<div class="button_holder">
|
| 79 |
+
<p id="load_on_click" class="load_buttom">Load More</p>
|
| 80 |
+
</div>
|
| 81 |
+
</div>
|
| 82 |
+
<?php } ?>
|
app/design/frontend/base/default/template/mkmage/loadmore/loadmore.phtml
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php //print_r($this->getData()); ?>
|
| 2 |
+
<?php $products = $this->getData('loadCollection') ?>
|
| 3 |
+
<?php $endCollection = $this->getData('endCollection') ?>
|
| 4 |
+
|
| 5 |
+
<?php foreach ($products as $product): ?>
|
| 6 |
+
|
| 7 |
+
<li>
|
| 8 |
+
<?php $prod = Mage::getModel('catalog/product')->load($product->getId()); ?>
|
| 9 |
+
<a href="<?php echo $prod->getProductUrl(); ?>" >
|
| 10 |
+
<img src="<?php echo Mage::helper('catalog/image')->init($prod, 'image')->resize(290,290); ?> "/>
|
| 11 |
+
<span class="search_name" >
|
| 12 |
+
<?php echo $prod->getName(); ?></span>
|
| 13 |
+
</a>
|
| 14 |
+
</li>
|
| 15 |
+
|
| 16 |
+
<?php endforeach; ?>
|
| 17 |
+
|
| 18 |
+
<?php if($endCollection): ?>
|
| 19 |
+
<input type="hidden" name="endCollection" value="true" id="endCollection">
|
| 20 |
+
<?php endif; ?>
|
app/etc/modules/MKMage_LoadMoreProducts.xml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<config>
|
| 2 |
+
<modules>
|
| 3 |
+
<MKMage_LoadMoreProducts>
|
| 4 |
+
<active>true</active>
|
| 5 |
+
<codePool>local</codePool>
|
| 6 |
+
</MKMage_LoadMoreProducts>
|
| 7 |
+
</modules>
|
| 8 |
+
</config>
|
app/etc/modules/MKMage_Mkcore.xml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<MKMage_Mkcore>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>local</codePool>
|
| 7 |
+
</MKMage_Mkcore>
|
| 8 |
+
</modules>
|
| 9 |
+
</config>
|
js/mkmage/loadmore/loadmore.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
jQuery( document ).ready(function() {
|
| 3 |
+
if (jQuery("#type_of_load").val() == 'button') {
|
| 4 |
+
jQuery("#load_on_click").on( "click", function() {
|
| 5 |
+
loadMore();
|
| 6 |
+
});
|
| 7 |
+
}
|
| 8 |
+
if (jQuery("#type_of_load").val() == 'scroll') {
|
| 9 |
+
jQuery("#load_on_click").css("display","none");
|
| 10 |
+
function bindScroll(){
|
| 11 |
+
if(jQuery(window).scrollTop() + jQuery(window).height() > jQuery(document).height() - 1) {
|
| 12 |
+
jQuery(window).unbind('scroll');
|
| 13 |
+
if(!jQuery('#endCollection').length) {
|
| 14 |
+
loadMore();
|
| 15 |
+
jQuery(window).bind('scroll', bindScroll);
|
| 16 |
+
}
|
| 17 |
+
}
|
| 18 |
+
}
|
| 19 |
+
jQuery(window).scroll(bindScroll);
|
| 20 |
+
}
|
| 21 |
+
});
|
| 22 |
+
|
| 23 |
+
function loadMore()
|
| 24 |
+
{
|
| 25 |
+
// console.log("More loaded");
|
| 26 |
+
var url = jQuery("#loadmore_ajax").val();
|
| 27 |
+
var page = jQuery("#page_num").val();
|
| 28 |
+
var num_spetps = jQuery("#num_spetps").val();
|
| 29 |
+
var subcat_ajax = jQuery("#subcat_ajax").val();
|
| 30 |
+
var product_id_ajax = jQuery("#product_id_ajax").val();
|
| 31 |
+
var item_per_load = jQuery("#item_per_load").val();
|
| 32 |
+
var obj = {
|
| 33 |
+
"page": page,
|
| 34 |
+
"category": subcat_ajax,
|
| 35 |
+
"item_per_load": item_per_load,
|
| 36 |
+
"product": product_id_ajax
|
| 37 |
+
};
|
| 38 |
+
//console.log(obj);
|
| 39 |
+
if (parseInt(parseInt(page)+2) > num_spetps) {
|
| 40 |
+
jQuery("#load_on_click").css("display","none");
|
| 41 |
+
}
|
| 42 |
+
if (page < num_spetps) {
|
| 43 |
+
jQuery("#page_num").val(parseInt(parseInt(page)+1));
|
| 44 |
+
console.log()
|
| 45 |
+
var request = jQuery.ajax({
|
| 46 |
+
url: url,
|
| 47 |
+
data: obj,
|
| 48 |
+
type: 'POST',
|
| 49 |
+
beforeSend: function(){ jQuery("#loadingicon").css("display","block"); },
|
| 50 |
+
dataType: 'html'
|
| 51 |
+
});
|
| 52 |
+
|
| 53 |
+
request.done(function(data){
|
| 54 |
+
//console.log(data);
|
| 55 |
+
jQuery('#loadmore').append(data);
|
| 56 |
+
jQuery("#loadingicon").css("display","none");
|
| 57 |
+
if(jQuery('#endCollection').length) {
|
| 58 |
+
if(jQuery('#endCollection').val()) {
|
| 59 |
+
jQuery("#load_on_click").remove();
|
| 60 |
+
}
|
| 61 |
+
}
|
| 62 |
+
});
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
|
package.xml
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>MKMage_LoadMoreProducts</name>
|
| 4 |
+
<version>0.1.0</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license>Open Software License (OSL)</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>Auto-load additional products with this AJAX-based extension.</summary>
|
| 10 |
+
<description>Draw customers' attention to products in Catalog providing a convenient way for browsing through additional products from product page. The AJAX-based LoadMoreProducts extension continuously loads more products as the user scrolls down the page, or on a click of a button. Avoid pagination and make catalog browsing more user-friendly by automatically loading more products from a specific category.</description>
|
| 11 |
+
<notes>- Ajax loader of additional products on Product Page
|
| 12 |
+
- Load products from specific category
|
| 13 |
+
- Load products from last child category
|
| 14 |
+
- Easily replace Related Products, Up-sell Products, Most Viewed Products functionalities
|
| 15 |
+
- Load additional products with scroll down
|
| 16 |
+
- Load additional products on a click of a button
|
| 17 |
+
- Option to set Header Name
|
| 18 |
+
- Option to set Number of items per one step
|
| 19 |
+
- Option to Enable/Disable extension
|
| 20 |
+
- Option to set Load Action (either Scroll or Button)
|
| 21 |
+
- Option to Enable/Disable loading of Additional Products functionality on Specific Product Pages</notes>
|
| 22 |
+
<authors><author><name>MKMage</name><user>mkmage</user><email>support@mkmage.com</email></author></authors>
|
| 23 |
+
<date>2016-04-01</date>
|
| 24 |
+
<time>19:23:23</time>
|
| 25 |
+
<contents><target name="magelocal"><dir name="MKMage"><dir name="LoadMoreProducts"><dir name="Block"><file name="Info.php" hash="c42f1ad9d886b9eb935016d10de08ee2"/></dir><dir name="Helper"><file name="Data.php" hash="845c78ebd1720d4d0cfaf89e19428321"/></dir><dir name="Model"><file name="Observer.php" hash="5409d27962912094310199b3796de71c"/><dir name="Select"><file name="Select.php" hash="2e567b8cd6693905528c0dc343fcbd86"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><file name=".DS_Store" hash="90f1f213e7e3216f862294bcc3a3c8c2"/></dir><dir name="controllers"><file name="IndexController.php" hash="e9ecba9f47e24443256feaa26ca88195"/></dir><dir name="etc"><file name="adminhtml.xml" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="config.xml" hash="354026a2211e7e1c12caedd38be5e93f"/><file name="system.xml" hash="11f99f10a7f4d8e2f895dded556904d5"/></dir><dir name="sql"><dir name="loadmore_setup"><file name="mysql4-install-0.1.0.php" hash="fe5acf8a1e85b608d90468249ac9c8cf"/></dir></dir></dir><dir name="Mkcore"><dir name="Block"><file name="Mkcore.php" hash="f423d477ed77d5abf5534dfb691da3d5"/></dir><dir name="Helper"><file name="Data.php" hash="fd776155a05a0c6072cb8f17d087d83b"/></dir><dir name="etc"><file name="config.xml" hash="17abb05de917d6982dac6c0225e77203"/><file name="system.xml" hash="164cd51bff905833ab0d3b39033cdc89"/></dir></dir><file name=".DS_Store" hash="1d72ade9ad3815c4cb4d4655009e6386"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="mkmage"><file name="loadmore.xml" hash="e14b4841d7b4fb813ff97309787e6bd4"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir></dir><dir name="template"><dir name="mkmage"><dir name="loadmore"><file name="definition.phtml" hash="a09de8994f3849c2dd29d0b76a9f6424"/><file name="loadmore.phtml" hash="daf3fbca303ffcd9d4b52fa86f597707"/></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="MKMage_LoadMoreProducts.xml" hash="1cfc1b288d6f9ca6b3c041f7b16386f8"/><file name="MKMage_Mkcore.xml" hash="9d4a95fc4e27a2d67eb91ed6312141e4"/></dir></target><target name="mage"><dir name="."><dir name="js"><dir name="mkmage"><dir name="loadmore"><file name="loadmore.js" hash="b1928b3f4a67534ba2ddeb59079a3799"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><file name="mkcore.png" hash="de2e975210a34a30c717e549d212b739"/></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="mkmage"><dir name="loadmore"><file name="loading_icon.gif" hash="b494fceca79586281a29c9462b09c85a"/></dir></dir></dir></dir></dir></dir></target></contents>
|
| 26 |
+
<compatible/>
|
| 27 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
| 28 |
+
</package>
|
skin/adminhtml/default/default/mkcore.png
ADDED
|
Binary file
|
skin/frontend/base/default/images/mkmage/loadmore/loading_icon.gif
ADDED
|
Binary file
|
