Skip to content

Commit

Permalink
Import Magento Release 1.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
Magento Mirror committed Jan 17, 2009
1 parent 9ebaba0 commit 4633251
Show file tree
Hide file tree
Showing 37 changed files with 314 additions and 140 deletions.
2 changes: 1 addition & 1 deletion app/Mage.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ final class Mage {

public static function getVersion()
{
return '1.1.7';
return '1.1.8';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/AdminNotification/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<system>
<children>
<adminnotification>
<title>Notification</title>
<title>Notifications</title>
<sort_order>10</sort_order>
<children>
<show_toolbar>
Expand Down
3 changes: 2 additions & 1 deletion app/code/core/Mage/Adminhtml/Block/Catalog/Category/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public function __construct()

protected function _prepareLayout()
{
if (Mage::app()->getConfig()->getModuleConfig('Mage_GoogleOptimizer')->is('active', true)) {
if (Mage::app()->getConfig()->getModuleConfig('Mage_GoogleOptimizer')->is('active', true)
&& Mage::helper('googleoptimizer')->isOptimizerActive()) {
$this->setChild('googleoptimizer_js',
$this->getLayout()->createBlock('googleoptimizer/js')->setTemplate('googleoptimizer/js.phtml')
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ public function editAction()
->_addContent($this->getLayout()->createBlock('adminhtml/cms_page_edit')->setData('action', $this->getUrl('*/cms_page/save')))
->_addLeft($this->getLayout()->createBlock('adminhtml/cms_page_edit_tabs'));

if (Mage::app()->getConfig()->getModuleConfig('Mage_GoogleOptimizer')->is('active', true)) {
if (Mage::app()->getConfig()->getModuleConfig('Mage_GoogleOptimizer')->is('active', true)
&& Mage::helper('googleoptimizer')->isOptimizerActive()) {
$this->_addJs($this->getLayout()->createBlock('googleoptimizer/js')->setTemplate('googleoptimizer/js.phtml'));
}

Expand Down
34 changes: 5 additions & 29 deletions app/code/core/Mage/Adminhtml/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@
</children>
</acl>
<store translate="title">
<title>Stores</title>
<title>Manage Stores</title>
</store>
<design>
<title>Design</title>
Expand Down Expand Up @@ -339,10 +339,6 @@
<title>Currency Setup Section</title>
<sort_order>120</sort_order>
</currency>
<allow>
<title>Allowed Settings</title>
<sort_order>130</sort_order>
</allow>
<rss>
<title>Rss Feeds Section</title>
<sort_order>135</sort_order>
Expand All @@ -358,7 +354,7 @@
</children>
</config>
<currency>
<title>Manage Currency</title>
<title>Manage Currency Rates</title>
<sort_order>30</sort_order>
</currency>
<email_template>
Expand All @@ -382,26 +378,10 @@
<title>Import/Export</title>
<children>
<gui>
<title>GUI Profiles</title>
<children>
<edit>
<title>Create/Edit/Delete profiles</title>
</edit>
<run>
<title>Run profiles</title>
</run>
</children>
<title>Profiles</title>
</gui>
<profiles>
<title>Advanced Profiles</title>
<children>
<edit>
<title>Create/Edit/Delete profiles</title>
</edit>
<run>
<title>Run profiles</title>
</run>
</children>
</profiles>
</children>
</convert>
Expand All @@ -413,16 +393,12 @@
<children>
<local>
<title>Magento Connect Manager</title>
<sort_order>0</sort_order>
</local>
<remote>
<title>Available Remote</title>
</remote>
<custom>
<title>Package Extensions</title>
<sort_order>5</sort_order>
</custom>
<config>
<title>PEAR Configuration</title>
</config>
</children>
</extensions>
</children>
Expand Down
5 changes: 4 additions & 1 deletion app/code/core/Mage/Catalog/Model/Product/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ public function getProductUrl($product)
$url = $product->getData($cacheUrlKey);

if (is_null($url)) {
if ($product->getStoreId()) {
$this->getUrlInstance()->setStore($product->getStoreId());
}
if ($product->hasData('request_path') && $product->getRequestPath() != '') {
$this->setData($cacheUrlKey, $this->getUrlInstance()->getDirectUrl($product->getRequestPath()));
return $this->getData($cacheUrlKey);
Expand All @@ -102,7 +105,7 @@ public function getProductUrl($product)
}

$rewrite->loadByIdPath($idPath);

//echo $this->getUrlInstance()->getBaseUrl();
if ($rewrite->getId()) {
$this->setData($cacheUrlKey, $this->getUrlInstance()->getDirectUrl($rewrite->getRequestPath()));
Varien_Profiler::stop('REWRITE: '.__METHOD__);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,14 @@ protected function _getLoadSelect($field, $value, $object)
*/
public function addCatalogInventoryToProductCollection($productCollection)
{
$isStockManagedInConfig = Mage::getStoreConfig(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_MANAGE_STOCK);
$isStockManagedInConfig = (int) Mage::getStoreConfig(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_MANAGE_STOCK);
$productCollection->joinTable('cataloginventory/stock_item',
'product_id=entity_id',
array(
'is_saleable' => new Zend_Db_Expr('(IF(IF(use_config_manage_stock, ' . $isStockManagedInConfig . ', manage_stock), is_in_stock, 1))'),
'inventory_in_stock' => 'is_in_stock'
),
null, 'left');

return $this;
}
}
10 changes: 9 additions & 1 deletion app/code/core/Mage/Checkout/Model/Type/Onepage.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ protected function _processValidateCustomer(Mage_Sales_Model_Quote_Address $addr
}

// invoke customer model, if it is registering
if ($address->getCustomerPassword()) {
if ('register' == $this->getQuote()->getCheckoutMethod()) {
// set customer password hash for further usage
$customer = Mage::getModel('customer/customer');
$this->getQuote()->setPasswordHash($customer->encryptPassword($address->getCustomerPassword()));
Expand All @@ -251,6 +251,14 @@ protected function _processValidateCustomer(Mage_Sales_Model_Quote_Address $addr
'message' => implode(', ', $validationResult)
);
}
} elseif('guest' == $this->getQuote()->getCheckoutMethod()) {
$email = $address->getData('email');
if (!Zend_Validate::is($email, 'EmailAddress')) {
return array(
'error' => -1,
'message' => Mage::helper('checkout')->__('Invalid email address "%s"', $email)
);
}
}

return true;
Expand Down
16 changes: 13 additions & 3 deletions app/code/core/Mage/Core/Model/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ abstract class Mage_Core_Model_Abstract extends Varien_Object
*/
protected $_cacheTag = false;

/**
* Flag which can stop data saving after before save
* Can be used for next sequence: we check data in _beforeSave, if data are
* not valid - we can set this flag to false value and save process will be stopped
*
* @var bool
*/
protected $_dataSaveAllowed = true;

/**
* Standard model initialization
*
Expand Down Expand Up @@ -238,9 +247,10 @@ public function save()
$this->_getResource()->beginTransaction();
try {
$this->_beforeSave();
$this->_getResource()->save($this);
$this->_afterSave();

if ($this->_dataSaveAllowed) {
$this->_getResource()->save($this);
$this->_afterSave();
}
$this->_getResource()->commit();
}
catch (Exception $e){
Expand Down
1 change: 1 addition & 0 deletions app/code/core/Mage/Core/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
<validation>
<http_user_agent_skip>
<flash>Shockwave Flash</flash>
<flash_9_mac>Adobe Flash Player 9</flash_9_mac>
<flash_10_mac>Adobe Flash Player 10</flash_10_mac>
</http_user_agent_skip>
</validation>
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/GoogleBase/Model/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected function _construct()
*/
public function getServiceItem()
{
return Mage::getModel('googlebase/service_item');
return Mage::getModel('googlebase/service_item')->setStoreId($this->getStoreId());
}

/**
Expand Down Expand Up @@ -185,7 +185,7 @@ protected function _checkProduct()
protected function _prepareProductObject()
{
$product = clone $this->getProduct();

/* @var $product Mage_Catalog_Model_Product */
$url = $product->getProductUrl();
if (!Mage::getStoreConfigFlag('web/url/use_store')) {
$urlInfo = parse_url($url);
Expand Down
10 changes: 4 additions & 6 deletions app/code/core/Mage/GoogleBase/Model/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ class Mage_GoogleBase_Model_Observer
*/
public function saveProductItem($observer)
{
if (Mage::getStoreConfigFlag('google/googlebase/observed')) {
$product = $observer->getEvent()->getProduct();

$product = $observer->getEvent()->getProduct();
if (Mage::getStoreConfigFlag('google/googlebase/observed', $product->getStoreId())) {
$collection = Mage::getResourceModel('googlebase/item_collection')
->addProductFilterId($product->getId())
->load();
Expand All @@ -65,9 +64,8 @@ public function saveProductItem($observer)
*/
public function deleteProductItem($observer)
{
if (Mage::getStoreConfigFlag('google/googlebase/observed')) {
$product = $observer->getEvent()->getProduct();

$product = $observer->getEvent()->getProduct();
if (Mage::getStoreConfigFlag('google/googlebase/observed', $product->getStoreId())) {
$collection = Mage::getResourceModel('googlebase/item_collection')
->addProductFilterId($product->getId())
->load();
Expand Down
14 changes: 7 additions & 7 deletions app/code/core/Mage/GoogleBase/Model/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ class Mage_GoogleBase_Model_Service extends Varien_Object
*
* @return Zend_Http_Client
*/
public function getClient()
public function getClient($storeId = null)
{
$user = Mage::getStoreConfig('google/googlebase/login');
$pass = Mage::getStoreConfig('google/googlebase/password');
$user = Mage::getStoreConfig('google/googlebase/login', $storeId);
$pass = Mage::getStoreConfig('google/googlebase/password', $storeId);

// Create an authenticated HTTP client
$errorMsg = Mage::helper('googlebase')->__('Unable to connect to Google Base. Please, check Account settings in configuration.');
Expand All @@ -63,10 +63,10 @@ public function getClient()
*
* @return Zend_Gdata_Gbase
*/
public function getService()
public function getService($storeId = null)
{
if (!$this->_service) {
$service = $this->_connect();
$service = $this->_connect($storeId);
$this->_service = $service;
}
return $this->_service;
Expand All @@ -77,9 +77,9 @@ public function getService()
*
* @return Zend_Gdata_Gbase
*/
protected function _connect()
protected function _connect($storeId = null)
{
$client = $this->getClient();
$client = $this->getClient($storeId);
$service = new Zend_Gdata_Gbase($client);
return $service;
}
Expand Down
16 changes: 8 additions & 8 deletions app/code/core/Mage/GoogleBase/Model/Service/Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,20 @@ class Mage_GoogleBase_Model_Service_Feed extends Mage_GoogleBase_Model_Service
* @param string $location
* @return Zend_Gdata_Feed
*/
public function getFeed($location = null)
public function getFeed($location = null, $storeId = null)
{
$query = new Zend_Gdata_Query($location);
return $this->getService()->getFeed($query);
return $this->getService($storeId)->getFeed($query);
}

/**
* Retrieve Items Statistics (expires, clicks, views, impr. etc.)
*
* @return array
*/
public function getItemsStatsArray()
public function getItemsStatsArray($storeId = null)
{
$feed = $this->getFeed(self::ITEMS_LOCATION);
$feed = $this->getFeed(self::ITEMS_LOCATION, $storeId);
$result = array();
foreach ($feed as $entry) {
$draft = 'no';
Expand Down Expand Up @@ -88,13 +88,13 @@ public function getItemsStatsArray()
*
* @return array
*/
public function getItemTypes()
public function getItemTypes($storeId = null)
{
if (is_array($this->_itemTypes)) {
return $this->_itemTypes;
}
$location = self::ITEM_TYPES_LOCATION . '/' . Mage::app()->getLocale()->getLocale();
$feed = $this->getFeed($location);
$feed = $this->getFeed($location, $storeId);

$itemTypes = array();
foreach ($feed->entries as $entry) {
Expand Down Expand Up @@ -132,9 +132,9 @@ public function getItemTypes()
* @param string $type Google Base Item Type
* @return array
*/
public function getAttributes($type)
public function getAttributes($type, $storeId = null)
{
$itemTypes = $this->getItemTypes();
$itemTypes = $this->getItemTypes($storeId);
if (isset($itemTypes[$type]) && $itemTypes[$type] instanceof Varien_Object) {
return $itemTypes[$type]->getAttributes();
}
Expand Down
18 changes: 18 additions & 0 deletions app/code/core/Mage/GoogleBase/Model/Service/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,19 @@ public function getItem()
return $this->_item;
}

/**
* Return Store level Service Instance
*
* @return Zend_Gdata_Gbase
*/
public function getService($storeId = null)
{
if ($storeId === null) {
$storeId = $this->getStoreId();
}
return parent::getService($storeId);
}

/**
* Insert Item into Google Base
*
Expand Down Expand Up @@ -262,10 +275,15 @@ protected function _setUniversalData()
$quantity = $object->getQuantity() ? max(1, (int)$object->getQuantity()) : 1;
$this->_setAttribute('quantity', $quantity, 'int');
}

if ($object->getImageUrl()) {
$this->_setAttribute('image_link', $object->getImageUrl(), 'url');
}

if ($country = Mage::getStoreConfig('google/googlebase/target_country', $this->getStoreId())) {
$this->_setAttribute('target_country', $country, 'text');
}

return $this;
}

Expand Down
Loading

0 comments on commit 4633251

Please sign in to comment.