Version Notes
Please not this is a framework and requires development.
Download this release
Release Info
| Developer | David Manners |
| Extension | Sitewards_StockCheck_Framework |
| Version | 1.0.0 |
| Comparing to | |
| See all releases | |
Version 1.0.0
- app/code/local/Sitewards/StockCheck/Helper/Data.php +55 -0
- app/code/local/Sitewards/StockCheck/Model/Product.php +96 -0
- app/code/local/Sitewards/StockCheck/controllers/CartController.php +45 -0
- app/code/local/Sitewards/StockCheck/etc/config.xml +111 -0
- app/code/local/Sitewards/StockCheck/etc/system.xml +133 -0
- app/etc/modules/Sitewards_StockCheck.xml +9 -0
- package.xml +19 -0
app/code/local/Sitewards/StockCheck/Helper/Data.php
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
*
|
| 4 |
+
* @category Mage
|
| 5 |
+
* @package Sitewards_StockCheck
|
| 6 |
+
* @copyright Copyright (c) 2011 Sitewards GmbH. (http://www.sitewards.com)
|
| 7 |
+
* @license OSL
|
| 8 |
+
* @author David Manners <david.manners@sitewards.com>
|
| 9 |
+
* @version 1.0.0
|
| 10 |
+
*
|
| 11 |
+
* This class is used to help the Sitewards_StockCheck_Model_Product class and requires the following functions to be created
|
| 12 |
+
* getCustomQuantity,
|
| 13 |
+
* getStorageType,
|
| 14 |
+
* getProductsStockOrder
|
| 15 |
+
*/
|
| 16 |
+
class Sitewards_StockCheck_Helper_Data extends Mage_Core_Helper_Abstract {
|
| 17 |
+
protected $intStockGreenId;
|
| 18 |
+
protected $intStockYellowId;
|
| 19 |
+
protected $intStockRedId;
|
| 20 |
+
protected $intStockOffId;
|
| 21 |
+
|
| 22 |
+
public function __construct() {
|
| 23 |
+
$this->intStockGreenId = Mage::getStoreConfig('stockcheck_config/stockcheck_img/stock_green_id');
|
| 24 |
+
$this->intStockYellowId = Mage::getStoreConfig('stockcheck_config/stockcheck_img/stock_yellow_id');
|
| 25 |
+
$this->intStockRedId = Mage::getStoreConfig('stockcheck_config/stockcheck_img/stock_red_id');
|
| 26 |
+
$this->intStockOffId = Mage::getStoreConfig('stockcheck_config/stockcheck_img/stock_off_id');
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
*
|
| 31 |
+
* @param int|string $mxdProductSku unique identifier for a product - defaults to Magento ProductId
|
| 32 |
+
* @return int real time stock level
|
| 33 |
+
*/
|
| 34 |
+
public function getCustomQuantity($mxdProductSku) {
|
| 35 |
+
Mage::throwException('StockCheck extension not correctly setup. Please complete the function getCustomQuantity in the helper '.get_class());
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
*
|
| 40 |
+
* @param int|string $mxdProductSku unique identifier for a product - defaults to Magento ProductId
|
| 41 |
+
* @return int constant related to real time stock level
|
| 42 |
+
*/
|
| 43 |
+
public function getStorageType($mxdProductSku) {
|
| 44 |
+
Mage::throwException('StockCheck extension not correctly setup. Please complete the function getCustomQuantity in the helper '.get_class());
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
/**
|
| 48 |
+
*
|
| 49 |
+
* @param int|string $mxdProductSku unique identifier for a product - defaults to Magento ProductId
|
| 50 |
+
* @return int current amount of stock taking into account the items on order
|
| 51 |
+
*/
|
| 52 |
+
public function getProductsStockOrder($mxdProductSku) {
|
| 53 |
+
Mage::throwException('StockCheck extension not correctly setup. Please complete the function getProductsStockOrder in the helper '.get_class());
|
| 54 |
+
}
|
| 55 |
+
}
|
app/code/local/Sitewards/StockCheck/Model/Product.php
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
*
|
| 4 |
+
* @category Mage
|
| 5 |
+
* @package Sitewards_StockCheck
|
| 6 |
+
* @copyright Copyright (c) 2011 Sitewards GmbH. (http://www.sitewards.com)
|
| 7 |
+
* @license OSL
|
| 8 |
+
* @author David Manners <david.manners@sitewards.com>
|
| 9 |
+
* @version 1.0.0
|
| 10 |
+
*
|
| 11 |
+
* This class is used to disable Magento´s default Quantity calculations
|
| 12 |
+
*/
|
| 13 |
+
class Sitewards_StockCheck_Model_Product extends Mage_Catalog_Model_Product {
|
| 14 |
+
protected $strProductIdentifierName;
|
| 15 |
+
protected $strHelperName;
|
| 16 |
+
protected $bolExtensionActive;
|
| 17 |
+
|
| 18 |
+
public function __construct() {
|
| 19 |
+
$this->strProductIdentifierName = Mage::getStoreConfig('stockcheck_config/stockcheck_group/product_identifier_name');
|
| 20 |
+
$this->strHelperName = Mage::getStoreConfig('stockcheck_config/stockcheck_group/helper_name');
|
| 21 |
+
$this->bolExtensionActive = Mage::getStoreConfig('stockcheck_config/stockcheck_group/disable_ext');
|
| 22 |
+
parent::__construct();
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
/**
|
| 26 |
+
*
|
| 27 |
+
* @return int stock level from external source or Mage_Catalog_Model_Product
|
| 28 |
+
*/
|
| 29 |
+
public function getQty() {
|
| 30 |
+
if($this->bolExtensionActive == true) {
|
| 31 |
+
$strProductIdentifierValue = $this->_getData($this->strProductIdentifierName);
|
| 32 |
+
|
| 33 |
+
if(method_exists(Mage::Helper($this->strHelperName), 'getCustomQuantity') == false) {
|
| 34 |
+
Mage::throwException('StockCheck extension not correctly setup. Please create the function getCustomQuantity in the helper '.$this->strHelperName);
|
| 35 |
+
} else {
|
| 36 |
+
$intCustomQty = Mage::Helper($this->strHelperName)->getCustomQuantity($strProductIdentifierValue);
|
| 37 |
+
if(!is_null($intCustomQty)) {
|
| 38 |
+
return $intCustomQty;
|
| 39 |
+
} else {
|
| 40 |
+
parent::getQty();
|
| 41 |
+
}
|
| 42 |
+
}
|
| 43 |
+
} else {
|
| 44 |
+
parent::getQty();
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
/**
|
| 49 |
+
*
|
| 50 |
+
* @param int $intQuantity requested level of quantity for a product - defaults to 1
|
| 51 |
+
* @return array contianing the source and alt text of stock light
|
| 52 |
+
*/
|
| 53 |
+
public function getStockAsLight($intQuantity = 1) {
|
| 54 |
+
if($this->bolExtensionActive != true) {
|
| 55 |
+
return;
|
| 56 |
+
}
|
| 57 |
+
$strProductIdentifierValue = $this->_getData($this->strProductIdentifierName);
|
| 58 |
+
|
| 59 |
+
if(method_exists(Mage::Helper($this->strHelperName), 'getStorageType') == false) {
|
| 60 |
+
Mage::throwException('StockCheck extension not correctly setup. Please create the function getStorageType in the helper '.$this->strHelperName);
|
| 61 |
+
} elseif(method_exists(Mage::Helper($this->strHelperName), 'getProductsStockOrder') == false) {
|
| 62 |
+
Mage::throwException('StockCheck extension not correctly setup. Please create the function getProductsStockOrder in the helper '.$this->strHelperName);
|
| 63 |
+
} else {
|
| 64 |
+
$intStorageTypeId = Mage::Helper($this->strHelperName)->getStorageType($strProductIdentifierValue, $intQuantity);
|
| 65 |
+
|
| 66 |
+
switch($intStorageTypeId) {
|
| 67 |
+
case Mage::getStoreConfig('stockcheck_config/stockcheck_img/stock_green_id'):
|
| 68 |
+
return array(
|
| 69 |
+
'source' => Mage::getStoreConfig('stockcheck_config/stockcheck_img/stock_green_img'),
|
| 70 |
+
'alt' => Mage::getStoreConfig('stockcheck_config/stockcheck_img/stock_green_text')
|
| 71 |
+
);
|
| 72 |
+
break;
|
| 73 |
+
|
| 74 |
+
case Mage::getStoreConfig('stockcheck_config/stockcheck_img/stock_yellow_id'):
|
| 75 |
+
return array(
|
| 76 |
+
'source' => Mage::getStoreConfig('stockcheck_config/stockcheck_img/stock_yellow_img'),
|
| 77 |
+
'alt' => Mage::getStoreConfig('stockcheck_config/stockcheck_img/stock_yellow_text')
|
| 78 |
+
);
|
| 79 |
+
break;
|
| 80 |
+
|
| 81 |
+
case Mage::getStoreConfig('stockcheck_config/stockcheck_img/stock_red_id'):
|
| 82 |
+
return array(
|
| 83 |
+
'source' => Mage::getStoreConfig('stockcheck_config/stockcheck_img/stock_red_img'),
|
| 84 |
+
'alt' => Mage::getStoreConfig('stockcheck_config/stockcheck_img/stock_red_text')
|
| 85 |
+
);
|
| 86 |
+
break;
|
| 87 |
+
|
| 88 |
+
default:
|
| 89 |
+
return array(
|
| 90 |
+
'source' => Mage::getStoreConfig('stockcheck_config/stockcheck_img/stock_off_img'),
|
| 91 |
+
'alt' => Mage::getStoreConfig('stockcheck_config/stockcheck_img/stock_off_text')
|
| 92 |
+
);
|
| 93 |
+
}
|
| 94 |
+
}
|
| 95 |
+
}
|
| 96 |
+
}
|
app/code/local/Sitewards/StockCheck/controllers/CartController.php
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
*
|
| 4 |
+
* @category Mage
|
| 5 |
+
* @package Sitewards_StockCheck
|
| 6 |
+
* @copyright Copyright (c) 2011 Sitewards GmbH. (http://www.sitewards.com)
|
| 7 |
+
* @license OSL
|
| 8 |
+
* @author David Manners <david.manners@sitewards.com>
|
| 9 |
+
* @version 1.0.0
|
| 10 |
+
*
|
| 11 |
+
* This class is used to override the Mage_Checkout_CartController and display an error message about stock levels
|
| 12 |
+
*/
|
| 13 |
+
|
| 14 |
+
require_once 'Mage/Checkout/controllers/CartController.php';
|
| 15 |
+
class Sitewards_StockCheck_CartController extends Mage_Checkout_CartController {
|
| 16 |
+
/**
|
| 17 |
+
*
|
| 18 |
+
* Override the cart indexAction functio to check for stock levels and display a message if required
|
| 19 |
+
*/
|
| 20 |
+
public function indexAction(){
|
| 21 |
+
$bolExtensionActive = Mage::getStoreConfig('stockcheck_config/stockcheck_group/disable_ext');
|
| 22 |
+
if($bolExtensionActive == true) {
|
| 23 |
+
$strProductIdentifierName = Mage::getStoreConfig('stockcheck_config/stockcheck_group/product_identifier_name');
|
| 24 |
+
$objCart = $this->_getCart();
|
| 25 |
+
foreach($this->_getCart()->getItems() as $objItem) {
|
| 26 |
+
$objProduct = $objItem->getProduct();
|
| 27 |
+
$strArtnr = $objProduct->getData($strProductIdentifierName);
|
| 28 |
+
if(empty($strArtnr)) {
|
| 29 |
+
$objProduct->load($objProduct->getId());
|
| 30 |
+
}
|
| 31 |
+
$intActualUnits = $objItem->getProduct()->getQty();
|
| 32 |
+
$intPurchasedUnits = $objItem->getQty();
|
| 33 |
+
$objMessageFactory = Mage::getSingleton('core/message');
|
| 34 |
+
if($intActualUnits == 0) {
|
| 35 |
+
$objMessage = $objMessageFactory->error(Mage::helper('checkout')->__('This item is currently out of stock and is on backorder in 2-4 working days', $intActualUnits, $intPurchasedUnits - $intActualUnits));
|
| 36 |
+
$objCart->getCheckoutSession()->addQuoteItemMessage($objItem->getId(), $objMessage);
|
| 37 |
+
} elseif($intPurchasedUnits > $intActualUnits) {
|
| 38 |
+
$objMessage = $objMessageFactory->error(Mage::helper('checkout')->__('We currently on have %d units in stock, the remaining %d units will be in stock in 2-4 working days', $intActualUnits, $intPurchasedUnits - $intActualUnits));
|
| 39 |
+
$objCart->getCheckoutSession()->addQuoteItemMessage($objItem->getId(), $objMessage);
|
| 40 |
+
}
|
| 41 |
+
}
|
| 42 |
+
}
|
| 43 |
+
parent::indexAction();
|
| 44 |
+
}
|
| 45 |
+
}
|
app/code/local/Sitewards/StockCheck/etc/config.xml
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Sitewards_StockCheck>
|
| 5 |
+
<version>1.0.0</version>
|
| 6 |
+
</Sitewards_StockCheck>
|
| 7 |
+
</modules>
|
| 8 |
+
|
| 9 |
+
<default>
|
| 10 |
+
<stockcheck_config>
|
| 11 |
+
<stockcheck_group>
|
| 12 |
+
<product_identifier_name>entity_id</product_identifier_name>
|
| 13 |
+
<disable_ext>0</disable_ext>
|
| 14 |
+
<helper_name>stockcheck</helper_name>
|
| 15 |
+
</stockcheck_group>
|
| 16 |
+
<stockcheck_img>
|
| 17 |
+
<stock_green_id>1</stock_green_id>
|
| 18 |
+
<stock_green_text>Item is in stock and can be delivered immediately.</stock_green_text>
|
| 19 |
+
<stock_green_img>/images/stock_green.gif</stock_green_img>
|
| 20 |
+
<stock_yellow_id>2</stock_yellow_id>
|
| 21 |
+
<stock_yellow_text>Item is currently out of stock, but has been ordered. There should be no delivery delays.</stock_yellow_text>
|
| 22 |
+
<stock_yellow_img>/images/stock_yellow.gif</stock_yellow_img>
|
| 23 |
+
<stock_red_id>3</stock_red_id>
|
| 24 |
+
<stock_red_text>Item is currently out of stock. It is expected to take approyimately 2-4 buisness days.</stock_red_text>
|
| 25 |
+
<stock_red_img>/images/stock_red.gif</stock_red_img>
|
| 26 |
+
<stock_off_id>4</stock_off_id>
|
| 27 |
+
<stock_off_text>Item is not a stock item. It is therefore expected 2-4 days later.</stock_off_text>
|
| 28 |
+
<stock_off_img>/images/stock_off.gif</stock_off_img>
|
| 29 |
+
</stockcheck_img>
|
| 30 |
+
</stockcheck_config>
|
| 31 |
+
</default>
|
| 32 |
+
|
| 33 |
+
<frontend>
|
| 34 |
+
<routers>
|
| 35 |
+
<Sitewards_StockCheck>
|
| 36 |
+
<use>standard</use>
|
| 37 |
+
<args>
|
| 38 |
+
<module>Sitewards_StockCheck</module>
|
| 39 |
+
<frontName>StockCheck</frontName>
|
| 40 |
+
</args>
|
| 41 |
+
</Sitewards_StockCheck>
|
| 42 |
+
<checkout>
|
| 43 |
+
<args>
|
| 44 |
+
<modules>
|
| 45 |
+
<Sitewards_StockCheck before="Mage_Checkout">Sitewards_StockCheck</Sitewards_StockCheck>
|
| 46 |
+
</modules>
|
| 47 |
+
</args>
|
| 48 |
+
</checkout>
|
| 49 |
+
</routers>
|
| 50 |
+
</frontend>
|
| 51 |
+
|
| 52 |
+
<global>
|
| 53 |
+
<models>
|
| 54 |
+
<catalog>
|
| 55 |
+
<rewrite>
|
| 56 |
+
<product>Sitewards_StockCheck_Model_Product</product>
|
| 57 |
+
</rewrite>
|
| 58 |
+
</catalog>
|
| 59 |
+
</models>
|
| 60 |
+
<helpers>
|
| 61 |
+
<stockcheck>
|
| 62 |
+
<class>Sitewards_StockCheck_Helper</class>
|
| 63 |
+
</stockcheck>
|
| 64 |
+
</helpers>
|
| 65 |
+
</global>
|
| 66 |
+
|
| 67 |
+
<adminhtml>
|
| 68 |
+
<acl>
|
| 69 |
+
<resources>
|
| 70 |
+
<admin>
|
| 71 |
+
<children>
|
| 72 |
+
<catalog>
|
| 73 |
+
<children>
|
| 74 |
+
<stockcheck_adminform>
|
| 75 |
+
<title>Configuration</title>
|
| 76 |
+
</stockcheck_adminform>
|
| 77 |
+
</children>
|
| 78 |
+
</catalog>
|
| 79 |
+
</children>
|
| 80 |
+
</admin>
|
| 81 |
+
</resources>
|
| 82 |
+
</acl>
|
| 83 |
+
<acl>
|
| 84 |
+
<resources>
|
| 85 |
+
<admin>
|
| 86 |
+
<children>
|
| 87 |
+
<system>
|
| 88 |
+
<children>
|
| 89 |
+
<config>
|
| 90 |
+
<children>
|
| 91 |
+
<stockcheck_config>
|
| 92 |
+
<title>Sitewards Stock Check</title>
|
| 93 |
+
</stockcheck_config>
|
| 94 |
+
</children>
|
| 95 |
+
</config>
|
| 96 |
+
</children>
|
| 97 |
+
</system>
|
| 98 |
+
<catalog>
|
| 99 |
+
<children>
|
| 100 |
+
<stockcheck_config translate="title">
|
| 101 |
+
<title>Sitewards Stock Check</title>
|
| 102 |
+
<sort_order>45</sort_order>
|
| 103 |
+
</stockcheck_config>
|
| 104 |
+
</children>
|
| 105 |
+
</catalog>
|
| 106 |
+
</children>
|
| 107 |
+
</admin>
|
| 108 |
+
</resources>
|
| 109 |
+
</acl>
|
| 110 |
+
</adminhtml>
|
| 111 |
+
</config>
|
app/code/local/Sitewards/StockCheck/etc/system.xml
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<config>
|
| 3 |
+
<sections>
|
| 4 |
+
<stockcheck_config translate="label comment" module="stockcheck">
|
| 5 |
+
<tab>catalog</tab>
|
| 6 |
+
<label>Sitewards Stock Check</label>
|
| 7 |
+
<frontend_type>text</frontend_type>
|
| 8 |
+
<sort_order>202</sort_order>
|
| 9 |
+
<show_in_default>1</show_in_default>
|
| 10 |
+
<show_in_website>1</show_in_website>
|
| 11 |
+
<show_in_store>1</show_in_store>
|
| 12 |
+
<groups>
|
| 13 |
+
<stockcheck_group translate="label" module="stockcheck">
|
| 14 |
+
<label>Sitewards Stock Check</label>
|
| 15 |
+
<sort_order>1</sort_order>
|
| 16 |
+
<show_in_default>1</show_in_default>
|
| 17 |
+
<show_in_website>1</show_in_website>
|
| 18 |
+
<show_in_store>1</show_in_store>
|
| 19 |
+
<fields>
|
| 20 |
+
<disable_ext translate="label" module="stockcheck">
|
| 21 |
+
<label>Disable Sitewards Stock Check</label>
|
| 22 |
+
<frontend_type>select</frontend_type>
|
| 23 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 24 |
+
<sort_order>1</sort_order>
|
| 25 |
+
<show_in_default>1</show_in_default>
|
| 26 |
+
<show_in_website>1</show_in_website>
|
| 27 |
+
<show_in_store>1</show_in_store>
|
| 28 |
+
</disable_ext>
|
| 29 |
+
<product_identifier_name translate="label" module="stockcheck">
|
| 30 |
+
<label>Product Identifier</label>
|
| 31 |
+
<frontend_type>text</frontend_type>
|
| 32 |
+
<sort_order>2</sort_order>
|
| 33 |
+
<show_in_default>1</show_in_default>
|
| 34 |
+
<show_in_website>1</show_in_website>
|
| 35 |
+
<show_in_store>1</show_in_store>
|
| 36 |
+
<comment><![CDATA[Attribute on which to identify your products]]></comment>
|
| 37 |
+
</product_identifier_name>
|
| 38 |
+
<helper_name translate="label" module="stockcheck">
|
| 39 |
+
<label>Helper Name</label>
|
| 40 |
+
<frontend_type>text</frontend_type>
|
| 41 |
+
<sort_order>3</sort_order>
|
| 42 |
+
<show_in_default>1</show_in_default>
|
| 43 |
+
<show_in_website>1</show_in_website>
|
| 44 |
+
<show_in_store>1</show_in_store>
|
| 45 |
+
<comment><![CDATA[Allows you to specify a custom helper class outside of the pricecheck extension]]></comment>
|
| 46 |
+
</helper_name>
|
| 47 |
+
</fields>
|
| 48 |
+
</stockcheck_group>
|
| 49 |
+
<stockcheck_img translate="label" module="stockcheck">
|
| 50 |
+
<label>Sitewards Stock Check Images</label>
|
| 51 |
+
<sort_order>2</sort_order>
|
| 52 |
+
<show_in_default>1</show_in_default>
|
| 53 |
+
<show_in_website>1</show_in_website>
|
| 54 |
+
<show_in_store>1</show_in_store>
|
| 55 |
+
<fields>
|
| 56 |
+
<stock_green_text translate="label" module="stockcheck">
|
| 57 |
+
<label>Stock Green Text</label>
|
| 58 |
+
<frontend_type>text</frontend_type>
|
| 59 |
+
<sort_order>1</sort_order>
|
| 60 |
+
<show_in_default>1</show_in_default>
|
| 61 |
+
<show_in_website>1</show_in_website>
|
| 62 |
+
<show_in_store>1</show_in_store>
|
| 63 |
+
<comment><![CDATA[This is the alt text for the image]]></comment>
|
| 64 |
+
</stock_green_text>
|
| 65 |
+
<stock_green_img translate="label" module="stockcheck">
|
| 66 |
+
<label>Stock Green Image</label>
|
| 67 |
+
<frontend_type>text</frontend_type>
|
| 68 |
+
<sort_order>2</sort_order>
|
| 69 |
+
<show_in_default>1</show_in_default>
|
| 70 |
+
<show_in_website>1</show_in_website>
|
| 71 |
+
<show_in_store>1</show_in_store>
|
| 72 |
+
<comment><![CDATA[This is the path to the image e.g. /images/stock_green.gif]]></comment>
|
| 73 |
+
</stock_green_img>
|
| 74 |
+
<stock_yellow_text translate="label" module="stockcheck">
|
| 75 |
+
<label>Stock Yellow Text</label>
|
| 76 |
+
<frontend_type>text</frontend_type>
|
| 77 |
+
<sort_order>3</sort_order>
|
| 78 |
+
<show_in_default>1</show_in_default>
|
| 79 |
+
<show_in_website>1</show_in_website>
|
| 80 |
+
<show_in_store>1</show_in_store>
|
| 81 |
+
<comment><![CDATA[This is the alt text for the image]]></comment>
|
| 82 |
+
</stock_yellow_text>
|
| 83 |
+
<stock_yellow_img translate="label" module="stockcheck">
|
| 84 |
+
<label>Stock Yellow Image</label>
|
| 85 |
+
<frontend_type>text</frontend_type>
|
| 86 |
+
<sort_order>4</sort_order>
|
| 87 |
+
<show_in_default>1</show_in_default>
|
| 88 |
+
<show_in_website>1</show_in_website>
|
| 89 |
+
<show_in_store>1</show_in_store>
|
| 90 |
+
<comment><![CDATA[This is the path to the image e.g. /images/stock_yellow.gif]]></comment>
|
| 91 |
+
</stock_yellow_img>
|
| 92 |
+
<stock_red_text translate="label" module="stockcheck">
|
| 93 |
+
<label>Stock Red Text</label>
|
| 94 |
+
<frontend_type>text</frontend_type>
|
| 95 |
+
<sort_order>5</sort_order>
|
| 96 |
+
<show_in_default>1</show_in_default>
|
| 97 |
+
<show_in_website>1</show_in_website>
|
| 98 |
+
<show_in_store>1</show_in_store>
|
| 99 |
+
<comment><![CDATA[This is the alt text for the image]]></comment>
|
| 100 |
+
</stock_red_text>
|
| 101 |
+
<stock_red_img translate="label" module="stockcheck">
|
| 102 |
+
<label>Stock Red Image</label>
|
| 103 |
+
<frontend_type>text</frontend_type>
|
| 104 |
+
<sort_order>6</sort_order>
|
| 105 |
+
<show_in_default>1</show_in_default>
|
| 106 |
+
<show_in_website>1</show_in_website>
|
| 107 |
+
<show_in_store>1</show_in_store>
|
| 108 |
+
<comment><![CDATA[This is the path to the image e.g. /images/stock_red.gif]]></comment>
|
| 109 |
+
</stock_red_img>
|
| 110 |
+
<stock_off_text translate="label" module="stockcheck">
|
| 111 |
+
<label>Stock Off Text</label>
|
| 112 |
+
<frontend_type>text</frontend_type>
|
| 113 |
+
<sort_order>7</sort_order>
|
| 114 |
+
<show_in_default>1</show_in_default>
|
| 115 |
+
<show_in_website>1</show_in_website>
|
| 116 |
+
<show_in_store>1</show_in_store>
|
| 117 |
+
<comment><![CDATA[This is the alt text for the image]]></comment>
|
| 118 |
+
</stock_off_text>
|
| 119 |
+
<stock_off_img translate="label" module="stockcheck">
|
| 120 |
+
<label>Stock Off Image</label>
|
| 121 |
+
<frontend_type>text</frontend_type>
|
| 122 |
+
<sort_order>8</sort_order>
|
| 123 |
+
<show_in_default>1</show_in_default>
|
| 124 |
+
<show_in_website>1</show_in_website>
|
| 125 |
+
<show_in_store>1</show_in_store>
|
| 126 |
+
<comment><![CDATA[This is the path to the image e.g. /images/stock_off.gif]]></comment>
|
| 127 |
+
</stock_off_img>
|
| 128 |
+
</fields>
|
| 129 |
+
</stockcheck_img>
|
| 130 |
+
</groups>
|
| 131 |
+
</stockcheck_config>
|
| 132 |
+
</sections>
|
| 133 |
+
</config>
|
app/etc/modules/Sitewards_StockCheck.xml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Sitewards_StockCheck>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>local</codePool>
|
| 7 |
+
</Sitewards_StockCheck>
|
| 8 |
+
</modules>
|
| 9 |
+
</config>
|
package.xml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>Sitewards_StockCheck_Framework</name>
|
| 4 |
+
<version>1.0.0</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license>OSL v3.0</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>This extension provides an easy to use framework for overriding the standard Magento Product stock model. It is ideal for loading a realtime stock from another datasoure.</summary>
|
| 10 |
+
<description>This extension is aimed at developers who want to load the stock level of a product in realtime from another source.
|
| 11 |
+
Coding is required but can be provided at a cost.</description>
|
| 12 |
+
<notes>Please not this is a framework and requires development.</notes>
|
| 13 |
+
<authors><author><name>David Manners</name><user>mrmanners</user><email>david.manners@sitewards.com</email></author><author><name>Sitewards GmbH</name><user>sitewards</user><email>mail@sitewards.com</email></author></authors>
|
| 14 |
+
<date>2011-11-16</date>
|
| 15 |
+
<time>15:24:25</time>
|
| 16 |
+
<contents><target name="magelocal"><dir name="Sitewards"><dir name="StockCheck"><dir name="Helper"><file name="Data.php" hash="0ad80591d36e36c6578a1e5d0ae07a9e"/></dir><dir name="Model"><file name="Product.php" hash="b3b38d7aba111767b1721606e5238af5"/></dir><dir name="controllers"><file name="CartController.php" hash="c2e9928f8ee70fc8cddb4b396f2adc55"/></dir><dir name="etc"><file name="config.xml" hash="86bad36f7c222dfb506782cc131c1c99"/><file name="system.xml" hash="b7fd46b5cc1820a688503dd637d08ece"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sitewards_StockCheck.xml" hash="66f6c25ea01dcf4dcab3f10c57c36b64"/></dir></target></contents>
|
| 17 |
+
<compatible/>
|
| 18 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
| 19 |
+
</package>
|
