本文整理汇总了PHP中Mage_Core_Model_Website::getDefaultGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Website::getDefaultGroup方法的具体用法?PHP Mage_Core_Model_Website::getDefaultGroup怎么用?PHP Mage_Core_Model_Website::getDefaultGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Website
的用法示例。
在下文中一共展示了Mage_Core_Model_Website::getDefaultGroup方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetDefaultGroup
public function testGetDefaultGroup()
{
$defaultGroup = $this->_model->getDefaultGroup();
$this->assertInstanceOf('Mage_Core_Model_Store_Group', $defaultGroup);
$this->assertEquals(1, $defaultGroup->getId());
$this->_model->setDefaultGroupId(null);
$this->assertFalse($this->_model->getDefaultGroup());
}
示例2: send
/**
* Send customer email
*
* @return bool
*/
public function send()
{
if (is_null($this->_website) || is_null($this->_customer)) {
return false;
}
if ($this->_type == 'price' && count($this->_priceProducts) == 0 || $this->_type == 'stock' && count($this->_stockProducts) == 0) {
return false;
}
if (!$this->_website->getDefaultGroup() || !$this->_website->getDefaultGroup()->getDefaultStore()) {
return false;
}
$store = $this->_website->getDefaultStore();
$storeId = $store->getId();
if ($this->_type == 'price' && !Mage::getStoreConfig(self::XML_PATH_EMAIL_PRICE_TEMPLATE, $storeId)) {
return false;
} elseif ($this->_type == 'stock' && !Mage::getStoreConfig(self::XML_PATH_EMAIL_STOCK_TEMPLATE, $storeId)) {
return false;
}
// set design parameters, required for email (remember current)
$currentDesign = Mage::getDesign()->setAllGetOld(array('store' => $storeId, 'area' => 'frontend', 'package' => Mage::getStoreConfig('design/package/name', $storeId)));
Mage::app()->getLocale()->emulate($storeId);
$translate = Mage::getSingleton('core/translate');
/* @var $translate Mage_Core_Model_Translate */
$translate->setTranslateInline(false);
if ($this->_type == 'price') {
$this->_getPriceBlock()->setStore($store)->reset();
foreach ($this->_priceProducts as $product) {
$product->setCustomerGroupId($this->_customer->getGroupId());
$this->_getPriceBlock()->addProduct($product);
}
$block = $this->_getPriceBlock()->toHtml();
$templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_PRICE_TEMPLATE, $storeId);
} elseif ($this->_type == 'stock') {
$this->_getStockBlock()->setStore($store)->reset();
foreach ($this->_stockProducts as $product) {
$product->setCustomerGroupId($this->_customer->getGroupId());
$this->_getStockBlock()->addProduct($product);
}
$block = $this->_getStockBlock()->toHtml();
$templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_STOCK_TEMPLATE, $storeId);
} else {
Mage::app()->getLocale()->revert();
return false;
}
Mage::getModel('core/email_template')->setDesignConfig(array('area' => 'frontend', 'store' => $storeId))->sendTransactional($templateId, Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId), $this->_customer->getEmail(), $this->_customer->getName(), array('customerName' => $this->_customer->getName(), 'alertGrid' => $block));
$translate->setTranslateInline(true);
// revert current design
Mage::getDesign()->setAllGetOld($currentDesign);
Mage::app()->getLocale()->revert();
return true;
}
示例3: send
/**
* Send customer email
*
* @return bool
*/
public function send()
{
if (is_null($this->_website) || is_null($this->_customer)) {
return false;
}
if ($this->_type == 'price' && count($this->_priceProducts) == 0 || $this->_type == 'stock' && count($this->_stockProducts) == 0) {
return false;
}
if (!$this->_website->getDefaultGroup() || !$this->_website->getDefaultGroup()->getDefaultStore()) {
return false;
}
$storeId = $this->_website->getDefaultGroup()->getDefaultStore()->getId();
$storeCode = $this->_website->getDefaultGroup()->getDefaultStore()->getCode();
if ($this->_type == 'price' && !Mage::getStoreConfig(self::XML_PATH_EMAIL_PRICE_TEMPLATE, $storeId)) {
return false;
} elseif ($this->_type == 'stock' && !Mage::getStoreConfig(self::XML_PATH_EMAIL_STOCK_TEMPLATE, $storeId)) {
return false;
}
Mage::getDesign()->setStore($storeId);
Mage::getDesign()->setArea('frontend');
$translate = Mage::getSingleton('core/translate');
/* @var $translate Mage_Core_Model_Translate */
$translate->setTranslateInline(false);
if ($this->_type == 'price') {
$this->_getPriceBlock()->setStoreCode($storeCode);
foreach ($this->_priceProducts as $product) {
$product->setCustomerGroupId($this->_customer->getGroupId());
$this->_getPriceBlock()->addProduct($product);
}
$block = $this->_getPriceBlock()->toHtml();
$templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_PRICE_TEMPLATE, $storeId);
} elseif ($this->_type == 'stock') {
$this->_getStockBlock()->setStoreCode($storeCode);
foreach ($this->_stockProducts as $product) {
$product->setCustomerGroupId($this->_customer->getGroupId());
$this->_getStockBlock()->addProduct($product);
}
$block = $this->_getStockBlock()->toHtml();
$templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_STOCK_TEMPLATE, $storeId);
} else {
return false;
}
Mage::getModel('core/email_template')->setDesignConfig(array('area' => 'frontend', 'store' => $storeId))->sendTransactional($templateId, Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId), $this->_customer->getEmail(), $this->_customer->getName(), array('customerName' => $this->_customer->getName(), 'alertGrid' => $block));
$translate->setTranslateInline(true);
return true;
}
示例4: send
/**
* Send customer email
*
* @return bool
*/
public function send()
{
if (is_null($this->_website) || is_null($this->_customer)) {
return false;
}
if ($this->_type == 'price' && count($this->_priceProducts) == 0 || $this->_type == 'stock' && count($this->_stockProducts) == 0) {
return false;
}
if (!$this->_website->getDefaultGroup() || !$this->_website->getDefaultGroup()->getDefaultStore()) {
return false;
}
$store = Mage::getModel('core/store')->load($this->_customer->getStoreId());
$storeId = $store->getId();
if ($this->_type == 'price' && !Mage::getStoreConfig(self::XML_PATH_EMAIL_PRICE_TEMPLATE, $storeId)) {
return false;
} elseif ($this->_type == 'stock' && !Mage::getStoreConfig(self::XML_PATH_EMAIL_STOCK_TEMPLATE, $storeId)) {
return false;
}
if ($this->_type != 'price' && $this->_type != 'stock') {
return false;
}
$appEmulation = Mage::getSingleton('core/app_emulation');
$initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
Mage::app()->getTranslator()->init('frontend', true);
if ($this->_type == 'price') {
$this->_getPriceBlock()->setStore($store)->reset();
foreach ($this->_priceProducts as $product) {
$product->setCustomerGroupId($this->_customer->getGroupId());
$this->_getPriceBlock()->addProduct($product);
}
$block = $this->_getPriceBlock()->toHtml();
$templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_PRICE_TEMPLATE, $storeId);
} else {
$this->_getStockBlock()->setStore($store)->reset();
foreach ($this->_stockProducts as $product) {
$product->setCustomerGroupId($this->_customer->getGroupId());
$this->_getStockBlock()->addProduct($product);
}
$block = $this->_getStockBlock()->toHtml();
$templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_STOCK_TEMPLATE, $storeId);
}
$appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
Mage::getModel('core/email_template')->setDesignConfig(array('area' => 'frontend', 'store' => $storeId))->sendTransactional($templateId, Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId), $this->_customer->getEmail(), $this->_customer->getName(), array('customerName' => $this->_customer->getName(), 'alertGrid' => $block));
return true;
}