Skip to content

Instantly share code, notes, and snippets.

@gistya
Created April 23, 2014 01:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gistya/11199755 to your computer and use it in GitHub Desktop.
Save gistya/11199755 to your computer and use it in GitHub Desktop.
BundlePricesPatchFileChanges.diff: patch the local overrides of Bundle pricing so that the Special Price is a set amount and not a percentage
From 87668bb649fc84d8103714d296d294b183835fc6 Mon Sep 17 00:00:00 2001
From: Gistya Eusebio <gistya@gmail.com>
Date: Tue, 22 Apr 2014 18:09:13 -0700
Subject: [PATCH] patch the local overrides of Bundle pricing so that the
Special Price is a set amount and not a percentage
---
.../Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes/Special.php | 6 ++++--
app/code/local/Mage/Bundle/Model/Product/Price.php | 5 +++--
app/code/local/Mage/Bundle/Model/Resource/Indexer/Price.php | 4 ++--
app/code/local/Mage/Bundle/Model/Resource/Price/Index.php | 5 +++--
4 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/app/code/local/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes/Special.php b/app/code/local/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes/Special.php
index 3d6ff4f..00592fc 100644
--- a/app/code/local/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes/Special.php
+++ b/app/code/local/Mage/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Attributes/Special.php
@@ -36,8 +36,10 @@ class Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Attributes_Special ex
public function getElementHtml()
{
$html = '<input id="'.$this->getElement()->getHtmlId().'" name="'.$this->getElement()->getName()
- .'" value="'.$this->getElement()->getEscapedValue().'" '.$this->getElement()->serialize($this->getElement()->getHtmlAttributes()).'/>'."\n"
- .'<strong>[%]</strong>';;
+ .'" value="'.$this->getElement()->getEscapedValue().'" '.$this->getElement()->serialize
+ ($this->getElement()->getHtmlAttributes()).'/>'."\n"
+ //.'<strong>[%]</strong>';;
+ .'<strong>[USD]</strong>';; //make it show the right thing
return $html;
}
}
diff --git a/app/code/local/Mage/Bundle/Model/Product/Price.php b/app/code/local/Mage/Bundle/Model/Product/Price.php
index b69b184..d0e5809 100644
--- a/app/code/local/Mage/Bundle/Model/Product/Price.php
+++ b/app/code/local/Mage/Bundle/Model/Product/Price.php
@@ -868,8 +868,9 @@ class Mage_Bundle_Model_Product_Price extends Mage_Catalog_Model_Product_Type_Pr
{
if (!is_null($specialPrice) && $specialPrice != false) {
if (Mage::app()->getLocale()->isStoreDateInInterval($store, $specialPriceFrom, $specialPriceTo)) {
- $specialPrice = Mage::app()->getStore()->roundPrice($finalPrice * $specialPrice / 100);
- $finalPrice = min($finalPrice, $specialPrice);
+ //$specialPrice = Mage::app()->getStore()->roundPrice($finalPrice * $specialPrice / 100);
+ //$finalPrice = min($finalPrice, $specialPrice);
+ $finalPrice = $specialPrice; //4-22-14 JG change to make the special price of bundles
}
}
diff --git a/app/code/local/Mage/Bundle/Model/Resource/Indexer/Price.php b/app/code/local/Mage/Bundle/Model/Resource/Indexer/Price.php
index 0fe3f7d..44788cd 100644
--- a/app/code/local/Mage/Bundle/Model/Resource/Indexer/Price.php
+++ b/app/code/local/Mage/Bundle/Model/Resource/Indexer/Price.php
@@ -226,13 +226,13 @@ class Mage_Bundle_Model_Resource_Indexer_Price extends Mage_Catalog_Model_Resour
'0'
)
)
- . " > 0 AND {$specialPrice} > 0 AND {$specialPrice} < 100 ",
+ . " > 0 AND {$specialPrice} > 0 ", // AND {$specialPrice} < 100 ",
$specialPrice,
'0'
);
$groupPriceExpr = $write->getCheckSql(
- 'gp.price IS NOT NULL AND gp.price > 0 AND gp.price < 100',
+ 'gp.price IS NOT NULL AND gp.price > 0 //AND gp.price < 100',
'gp.price',
'0'
);
diff --git a/app/code/local/Mage/Bundle/Model/Resource/Price/Index.php b/app/code/local/Mage/Bundle/Model/Resource/Price/Index.php
index f892ef7..bc2c161 100644
--- a/app/code/local/Mage/Bundle/Model/Resource/Price/Index.php
+++ b/app/code/local/Mage/Bundle/Model/Resource/Price/Index.php
@@ -811,8 +811,9 @@ class Mage_Bundle_Model_Resource_Price_Index extends Mage_Core_Model_Resource_Db
if (!is_null($specialPrice) && $specialPrice != false) {
if (Mage::app()->getLocale()->isStoreDateInInterval($store, $priceData['special_from_date'],
$priceData['special_to_date'])) {
- $specialPrice = ($finalPrice * $specialPrice) / 100;
- $finalPrice = min($finalPrice, $specialPrice);
+ //$specialPrice = ($finalPrice * $specialPrice) / 100;
+ //$finalPrice = min($finalPrice, $specialPrice);
+ $finalPrice = $specialPrice;
}
}
--
1.8.4.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment