本文整理汇总了PHP中Ess_M2ePro_Model_Magento_Product类的典型用法代码示例。如果您正苦于以下问题:PHP Ess_M2ePro_Model_Magento_Product类的具体用法?PHP Ess_M2ePro_Model_Magento_Product怎么用?PHP Ess_M2ePro_Model_Magento_Product使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Ess_M2ePro_Model_Magento_Product类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: getBundleProductDynamicSpecialValue
protected function getBundleProductDynamicSpecialValue(Ess_M2ePro_Model_Magento_Product $product)
{
if ($this->getIsSalePrice() && !$product->isSpecialPriceActual()) {
return 0;
}
return parent::getBundleProductDynamicSpecialValue($product);
}
示例3: getSource
/**
* @param Ess_M2ePro_Model_Magento_Product $magentoProduct
* @return Ess_M2ePro_Model_Ebay_Template_Shipping_Service_Source
*/
public function getSource(Ess_M2ePro_Model_Magento_Product $magentoProduct)
{
$productId = $magentoProduct->getProductId();
if (!empty($this->shippingServiceSourceModels[$productId])) {
return $this->shippingServiceSourceModels[$productId];
}
$this->shippingServiceSourceModels[$productId] = Mage::getModel('M2ePro/Ebay_Template_Shipping_Service_Source');
$this->shippingServiceSourceModels[$productId]->setMagentoProduct($magentoProduct);
$this->shippingServiceSourceModels[$productId]->setShippingServiceTemplate($this);
return $this->shippingServiceSourceModels[$productId];
}
示例4: getSource
/**
* @param Ess_M2ePro_Model_Magento_Product $magentoProduct
* @return Ess_M2ePro_Model_Amazon_Template_Description_Specific_Source
*/
public function getSource(Ess_M2ePro_Model_Magento_Product $magentoProduct)
{
$productId = $magentoProduct->getProductId();
if (!empty($this->descriptionSpecificSourceModels[$productId])) {
return $this->descriptionSpecificSourceModels[$productId];
}
$this->descriptionSpecificSourceModels[$productId] = Mage::getModel('M2ePro/Amazon_Template_Description_Specific_Source');
$this->descriptionSpecificSourceModels[$productId]->setMagentoProduct($magentoProduct);
$this->descriptionSpecificSourceModels[$productId]->setDescriptionSpecificTemplate($this);
return $this->descriptionSpecificSourceModels[$productId];
}
示例5: getSource
/**
* @param Ess_M2ePro_Model_Magento_Product $magentoProduct
* @return Ess_M2ePro_Model_Buy_Template_NewProduct_Attribute_Source
*/
public function getSource(Ess_M2ePro_Model_Magento_Product $magentoProduct)
{
$productId = $magentoProduct->getProductId();
if (!empty($this->newProductAttributeSourceModels[$productId])) {
return $this->newProductAttributeSourceModels[$productId];
}
$this->newProductAttributeSourceModels[$productId] = Mage::getModel('M2ePro/Buy_Template_NewProduct_Attribute_Source');
$this->newProductAttributeSourceModels[$productId]->setMagentoProduct($magentoProduct);
$this->newProductAttributeSourceModels[$productId]->setNewProductAttributeTemplate($this);
return $this->newProductAttributeSourceModels[$productId];
}
示例6: getSource
/**
* @param Ess_M2ePro_Model_Magento_Product $magentoProduct
* @return Ess_M2ePro_Model_Ebay_Template_Category_Specific_Source
*/
public function getSource(Ess_M2ePro_Model_Magento_Product $magentoProduct)
{
$productId = $magentoProduct->getProductId();
if (!empty($this->categorySpecificSourceModels[$productId])) {
return $this->categorySpecificSourceModels[$productId];
}
$this->categorySpecificSourceModels[$productId] = Mage::getModel('M2ePro/Ebay_Template_Category_Specific_Source');
$this->categorySpecificSourceModels[$productId]->setMagentoProduct($magentoProduct);
$this->categorySpecificSourceModels[$productId]->setCategorySpecificTemplate($this);
return $this->categorySpecificSourceModels[$productId];
}
示例7: getSource
/**
* @param Ess_M2ePro_Model_Magento_Product $magentoProduct
* @return Ess_M2ePro_Model_Play_Listing_Source
*/
public function getSource(Ess_M2ePro_Model_Magento_Product $magentoProduct)
{
$productId = $magentoProduct->getProductId();
if (!empty($this->listingSourceModels[$productId])) {
return $this->listingSourceModels[$productId];
}
$this->listingSourceModels[$productId] = Mage::getModel('M2ePro/Play_Listing_Source');
$this->listingSourceModels[$productId]->setMagentoProduct($magentoProduct);
$this->listingSourceModels[$productId]->setListing($this->getParentObject());
return $this->listingSourceModels[$productId];
}
示例8: getOptions
private function getOptions(Ess_M2ePro_Model_Magento_Product $magentoProduct)
{
$variation = $this->proxyItem->getLowerCasedVariation();
$magentoOptions = $magentoProduct->getProductVariationsForOrder();
// Variation info unavailable - return first value for each required option
// ---------------
if (empty($variation)) {
$firstOptions = array();
foreach ($magentoOptions as $option) {
$firstOptions[$option['option_id']] = $option['values'][0]['value_id'];
}
return $firstOptions;
}
// ---------------
// Map variation with magento options
// ---------------
$mappedOptions = array();
foreach ($magentoOptions as $option) {
$optionValueLabel = $this->getMappedOptionValueLabel($variation, $option['labels']);
if ($optionValueLabel == '') {
continue;
}
$optionValueId = $this->getMappedOptionValueId($optionValueLabel, $option['values']);
if (is_null($optionValueId)) {
continue;
}
$mappedOptions[$option['option_id']] = $optionValueId;
}
// ---------------
return $mappedOptions;
}
示例9: insertMediaGalleries
private function insertMediaGalleries($text, Ess_M2ePro_Model_Magento_Product $magentoProduct)
{
preg_match_all("/#media_gallery\\[(.*?)\\]#/", $text, $matches);
if (!count($matches[0])) {
return $text;
}
$blockObj = Mage::getSingleton('core/layout')->createBlock('M2ePro/adminhtml_renderer_description_gallery');
$search = array();
$replace = array();
$attributeCounter = 0;
foreach ($matches[0] as $key => $match) {
$tempMediaGalleryAttributes = explode(',', $matches[1][$key]);
$realMediaGalleryAttributes = array();
for ($i = 0; $i < 8; $i++) {
if (!isset($tempMediaGalleryAttributes[$i])) {
$realMediaGalleryAttributes[$i] = '';
} else {
$realMediaGalleryAttributes[$i] = $tempMediaGalleryAttributes[$i];
}
}
$imagesQty = (int) $realMediaGalleryAttributes[5];
if ($imagesQty == self::IMAGES_QTY_ALL) {
$imagesQty = $realMediaGalleryAttributes[3] == self::IMAGES_MODE_GALLERY ? 100 : 25;
}
$galleryImagesLinks = $magentoProduct->getGalleryImagesLinks($imagesQty);
if (!count($galleryImagesLinks)) {
$search = $matches[0];
$replace = '';
break;
}
if (!in_array($realMediaGalleryAttributes[4], array(self::LAYOUT_MODE_ROW, self::LAYOUT_MODE_COLUMN))) {
$realMediaGalleryAttributes[4] = self::LAYOUT_MODE_ROW;
}
$data = array('width' => (int) $realMediaGalleryAttributes[0], 'height' => (int) $realMediaGalleryAttributes[1], 'margin' => (int) $realMediaGalleryAttributes[2], 'linked_mode' => (int) $realMediaGalleryAttributes[3], 'layout' => $realMediaGalleryAttributes[4], 'gallery_hint' => trim($realMediaGalleryAttributes[6], '"'), 'watermark' => (int) $realMediaGalleryAttributes[7], 'images_count' => count($galleryImagesLinks), 'image_counter' => 0);
$tempHtml = '';
$attributeCounter++;
foreach ($galleryImagesLinks as $imageLink) {
$data['image_counter']++;
$data['attribute_counter'] = $attributeCounter;
$data['src'] = $imageLink;
$tempHtml .= $blockObj->addData($data)->toHtml();
}
$search[] = $match;
$replace[] = preg_replace('/\\s{2,}/', '', $tempHtml);
}
$text = str_replace($search, $replace, $text);
return $text;
}
示例10: getSource
/**
* @param Ess_M2ePro_Model_Magento_Product $magentoProduct
* @return Ess_M2ePro_Model_Ebay_Template_Description_Source
*/
public function getSource(Ess_M2ePro_Model_Magento_Product $magentoProduct)
{
$productId = $magentoProduct->getProductId();
if (!empty($this->descriptionSourceModels[$productId])) {
return $this->descriptionSourceModels[$productId];
}
$this->descriptionSourceModels[$productId] = Mage::getModel('M2ePro/Ebay_Template_Description_Source');
$this->descriptionSourceModels[$productId]->setMagentoProduct($magentoProduct);
$this->descriptionSourceModels[$productId]->setDescriptionTemplate($this->getParentObject());
return $this->descriptionSourceModels[$productId];
}
示例11: changeProductQty
private function changeProductQty(Ess_M2ePro_Model_Magento_Product $magentoProduct, Ess_M2ePro_Model_Magento_Product_StockItem $magentoStockItem, $action, $qty)
{
$result = true;
switch ($action) {
case self::ACTION_ADD:
$magentoStockItem->addQty($qty, false);
break;
case self::ACTION_SUB:
try {
$magentoStockItem->subtractQty($qty, false);
} catch (Exception $e) {
$result = false;
$this->order->setActionRequired(true);
$this->order->addErrorLog('Qty for product "%name%" cannot be reserved. Reason: %msg%', array('!name' => $magentoProduct->getName(), 'msg' => $e->getMessage()));
}
break;
}
return $result;
}
示例12: getBundleProductDynamicValue
protected function getBundleProductDynamicValue(Ess_M2ePro_Model_Magento_Product $product)
{
$value = 0;
$variationsData = $product->getVariationInstance()->getVariationsTypeStandard();
foreach ($variationsData['variations'] as $variation) {
$variationValue = 0;
foreach ($variation as $option) {
/** @var $childProduct Ess_M2ePro_Model_Magento_Product */
$childProduct = Mage::getModel('M2ePro/Magento_Product')->setProductId($option['product_id']);
$optionValue = (double) $childProduct->getSpecialPrice();
$optionValue <= 0 && ($optionValue = (double) $childProduct->getPrice());
$variationValue += $optionValue;
}
if ($variationValue < $value || $value == 0) {
$value = $variationValue;
}
}
return $this->convertValueFromStoreToMarketplace($value);
}
示例13: match
private function match()
{
$this->validate();
/** @var Ess_M2ePro_Model_Amazon_Listing_Product_Variation_Matcher_Attribute $attributeMatcher */
$attributeMatcher = Mage::getModel('M2ePro/Amazon_Listing_Product_Variation_Matcher_Attribute');
if (!is_null($this->magentoProduct)) {
if ($this->magentoProduct->isGroupedType()) {
$this->matchedTheme = null;
return $this;
}
$attributeMatcher->setMagentoProduct($this->magentoProduct);
}
if (!empty($this->sourceAttributes)) {
$attributeMatcher->setSourceAttributes($this->sourceAttributes);
$attributeMatcher->canUseDictionary(false);
}
foreach ($this->themes as $themeName => $themeAttributes) {
$attributeMatcher->setDestinationAttributes($themeAttributes['attributes']);
if ($attributeMatcher->isAmountEqual() && $attributeMatcher->isFullyMatched()) {
$this->matchedTheme = $themeName;
break;
}
}
return $this;
}
示例14: getSourceOptionNames
private function getSourceOptionNames($sourceOption)
{
$magentoOptionNames = $this->magentoProduct->getVariationInstance()->getTitlesVariationSet();
$resultNames = array();
foreach ($magentoOptionNames as $attribute => $data) {
$resultNames[$attribute] = $this->prepareOptionNames($sourceOption[$attribute], $data['values'][$sourceOption[$attribute]]);
}
return $resultNames;
}
示例15: getMagentoProduct
public function getMagentoProduct()
{
if (is_null($this->getProductId())) {
return NULL;
}
if (is_null($this->magentoProduct)) {
$this->magentoProduct = Mage::getModel('M2ePro/Magento_Product');
$this->magentoProduct->setStoreId($this->getOrder()->getStoreId())->setProductId($this->getProductId());
}
return $this->magentoProduct;
}