Skip to content

Commit 93476bf

Browse files
authored
Merge pull request #62 from EmilsM/feature/include-out-of-stock-products
Include out of stock products in sync in the Magento Admin panel
2 parents e7aac02 + 09595b2 commit 93476bf

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

code/Model/Catalog/Product.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ public function getClerkExportData()
2424
{
2525
$data = new Varien_Object();
2626

27-
$data->setAge((int) $this->getAge());
27+
$data->setAge((int)$this->getAge());
2828
$data->setCategories(array_map('intval', $this->getCategoryIds()));
2929
$data->setDescription($this->getDescription() ? $this->getDescription() : '');
3030
$data->setHasTierprice($this->hasTierPrice());
31-
$data->setId((int) $this->getId());
31+
$data->setId((int)$this->getId());
3232
$data->setImage($this->getClerkImageUrl());
3333
$data->setIsOnSale($this->isOnSale());
3434
$data->setManufacturer($this->getManufacturer());
@@ -67,8 +67,10 @@ public function setExcludeReason()
6767
$this->excludeReason = 'Product not visible';
6868
}
6969

70-
if (!$this->isSalable()) {
71-
$this->excludeReason = 'Product is not saleable';
70+
if (!Mage::getStoreConfigFlag('clerk/general/include_out_of_stock_products')) {
71+
if (!$this->isSalable()) {
72+
$this->excludeReason = 'Product is not saleable';
73+
}
7274
}
7375

7476
if ($this->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_DISABLED) {

code/Model/Productpage.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ public function load($page, $limit)
1919
->addStoreFilter();
2020

2121
//Only grab products in stock
22-
Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($this->collection);
22+
if(!Mage::getStoreConfigFlag('clerk/general/include_out_of_stock_products')) {
23+
Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($this->collection);
24+
}
2325

2426
$this->totalPages = $this->collection->getLastPageNumber();
2527
$this->fetch();

code/etc/config.xml

+1
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@
181181
<active>0</active>
182182
<collect_emails>1</collect_emails>
183183
<disable_order_synchronization>0</disable_order_synchronization>
184+
<include_out_of_stock_products>0</include_out_of_stock_products>
184185
</general>
185186
<search>
186187
<active>0</active>

code/etc/system.xml

+7
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@
7676
<show_in_store>1</show_in_store>
7777
<source_model>adminhtml/system_config_source_yesno</source_model>
7878
</disable_order_synchronization>
79+
<include_out_of_stock_products>
80+
<label>Include Out Of Stock Products</label>
81+
<frontend_type>select</frontend_type>
82+
<sort_order>40</sort_order>
83+
<show_in_store>1</show_in_store>
84+
<source_model>adminhtml/system_config_source_yesno</source_model>
85+
</include_out_of_stock_products>
7986
<url>
8087
<label>Import url</label>
8188
<frontend_type>select</frontend_type>

0 commit comments

Comments
 (0)