本文整理汇总了PHP中Ess_M2ePro_Model_Magento_Product::getProduct方法的典型用法代码示例。如果您正苦于以下问题:PHP Ess_M2ePro_Model_Magento_Product::getProduct方法的具体用法?PHP Ess_M2ePro_Model_Magento_Product::getProduct怎么用?PHP Ess_M2ePro_Model_Magento_Product::getProduct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ess_M2ePro_Model_Magento_Product
的用法示例。
在下文中一共展示了Ess_M2ePro_Model_Magento_Product::getProduct方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDescription
private function getDescription(Ess_M2ePro_Model_Magento_Product $magentoProduct, Ess_M2ePro_Model_Listing_Product $listingProduct = NULL)
{
$descriptionTemplateData = $this->_getSession()->getTemplateData();
$descriptionModeProduct = Ess_M2ePro_Model_Ebay_Template_Description::DESCRIPTION_MODE_PRODUCT;
$descriptionModeShort = Ess_M2ePro_Model_Ebay_Template_Description::DESCRIPTION_MODE_SHORT;
$descriptionModeCustom = Ess_M2ePro_Model_Ebay_Template_Description::DESCRIPTION_MODE_CUSTOM;
if ($descriptionTemplateData['description_mode'] == $descriptionModeProduct) {
$description = $magentoProduct->getProduct()->getDescription();
} elseif ($descriptionTemplateData['description_mode'] == $descriptionModeShort) {
$description = $magentoProduct->getProduct()->getShortDescription();
} elseif ($descriptionTemplateData['description_mode'] == $descriptionModeCustom) {
$description = $descriptionTemplateData['description_template'];
} else {
$description = '';
}
if (empty($description)) {
return $description;
}
$renderer = Mage::helper('M2ePro/Module_Renderer_Description');
$description = $renderer->parseTemplate($description, $magentoProduct);
if (!is_null($listingProduct)) {
/** @var Ess_M2ePro_Model_Ebay_Listing_Product_Description_Renderer $renderer */
$renderer = Mage::getSingleton('M2ePro/Ebay_Listing_Product_Description_Renderer');
$renderer->setListingProduct($listingProduct->getChildObject());
$description = $renderer->parseTemplate($description);
}
$this->addWatermarkInfoToDescriptionIfNeed($description);
return $description;
}
示例2: insertAttributes
private function insertAttributes($text, Ess_M2ePro_Model_Magento_Product $magentoProduct)
{
preg_match_all("/#([a-zA-Z_0-9]+?)#/", $text, $matches);
if (!count($matches[0])) {
return $text;
}
$search = array();
$replace = array();
foreach ($matches[1] as $attributeCode) {
$value = $magentoProduct->getAttributeValue($attributeCode);
if (!is_array($value) && $value != '') {
if ($attributeCode == 'description') {
$value = $this->normalizeDescription($value);
} elseif ($attributeCode == 'weight') {
$value = (double) $value;
} elseif (in_array($attributeCode, array('price', 'special_price'))) {
$value = round($value, 2);
$storeId = $magentoProduct->getProduct()->getStoreId();
$store = Mage::app()->getStore($storeId);
$value = $store->formatPrice($value, false);
}
$search[] = '#' . $attributeCode . '#';
$replace[] = $value;
} else {
$search[] = '#' . $attributeCode . '#';
$replace[] = '';
}
}
$text = str_replace($search, $replace, $text);
return $text;
}
示例3: getDescription
private function getDescription($descriptionMode, $customDescription, Ess_M2ePro_Model_Magento_Product $magentoProduct, Ess_M2ePro_Model_Listing_Product $listingProduct = NULL)
{
$description = '';
$descriptionModeProduct = Ess_M2ePro_Model_Ebay_Template_Description::DESCRIPTION_MODE_PRODUCT;
$descriptionModeShort = Ess_M2ePro_Model_Ebay_Template_Description::DESCRIPTION_MODE_SHORT;
$descriptionModeCustom = Ess_M2ePro_Model_Ebay_Template_Description::DESCRIPTION_MODE_CUSTOM;
if ($descriptionModeProduct == $descriptionMode) {
$description = $magentoProduct->getProduct()->getDescription();
} elseif ($descriptionModeShort == $descriptionMode) {
$description = $magentoProduct->getProduct()->getShortDescription();
} elseif ($descriptionModeCustom == $descriptionMode) {
$description = $customDescription;
}
if (empty($description)) {
return $description;
}
$renderer = Mage::helper('M2ePro/Module_Renderer_Description');
$description = $renderer->parseTemplate($description, $magentoProduct);
if (!is_null($listingProduct)) {
/** @var Ess_M2ePro_Model_Ebay_Listing_Product_Description_Renderer $renderer */
$renderer = Mage::getSingleton('M2ePro/Ebay_Listing_Product_Description_Renderer');
$renderer->setListingProduct($listingProduct->getChildObject());
$description = $renderer->parseTemplate($description);
}
return $description;
}