public function __get($strName) { switch ($strName) { case 'Name': return $this->Title; case 'IsMaster': return $this->IsMaster(); case 'IsChild': return $this->IsChild(); case 'IsIndependent': return $this->IsIndependent(); case 'Slug': return $this->GetSlug(); case 'Code': if ($this->IsChild()) { if ($prod = $this->GetMaster()) { return $prod->code; } } return $this->code; case 'FkProductMaster': return $this->GetMaster(); case 'InventoryDisplay': return $this->InventoryDisplay(); case 'Family': if (isset($this->family)) { return $this->family->family; } else { return ''; } case 'Class': if (isset($this->class)) { return $this->class->class_name; } else { return ''; } case 'Url': case 'Link': return $this->getUrl(); case 'SEOName': return $this->GetSEOName(); case 'AbsoluteUrl': return $this->GetAbsoluteUrl(); case 'AddToCartImage': return $this->GetImageLink(ImagesType::addtocartmodal); case 'ListingImage': return $this->GetImageLink(ImagesType::listing); case 'ListingImageAbsolute': return $this->GetImageLink(ImagesType::listing, true); case 'MiniImage': return $this->GetImageLink(ImagesType::mini); case 'MiniImageAbsolute': return $this->GetImageLink(ImagesType::mini, true); case 'MiniImageTag': return CHtml::image(Images::GetLink($this->image_id, ImagesType::mini)); case 'PreviewImage': return $this->GetImageLink(ImagesType::preview); case 'PreviewImageAbsolute': return $this->GetImageLink(ImagesType::preview, true); case 'PreviewImageTag': return CHtml::image(Images::GetLink($this->image_id, ImagesType::preview)); case 'SliderImage': return $this->GetImageLink(ImagesType::slider); case 'SliderImageAbsolute': return $this->GetImageLink(ImagesType::slider, true); case 'SliderImageTag': return CHtml::image(Images::GetLink($this->image_id, ImagesType::slider)); case 'CategoryImage': return $this->GetImageLink(ImagesType::category); case 'CategoryImageAbsolute': return $this->GetImageLink(ImagesType::category, true); case 'CategoryImageTag': return CHtml::image(Images::GetLink($this->image_id, ImagesType::category)); case 'PDetailImage': return $this->GetImageLink(ImagesType::pdetail); case 'PDetailImageAbsolute': return $this->GetImageLink(ImagesType::pdetail, true); case 'PDetailImageTag': return CHtml::image(Images::GetLink($this->image_id, ImagesType::pdetail)); case 'SmallImage': return $this->GetImageLink(ImagesType::small); case 'SmallImageAbsolute': return $this->GetImageLink(ImagesType::small, true); case 'SmallImageTag': return CHtml::image(Images::GetLink($this->image_id, ImagesType::small)); case 'Image': return $this->GetImageLink(ImagesType::normal); case 'ImageAbsolute': return $this->GetImageLink(ImagesType::normal, true); case 'ImageTag': return CHtml::image(Images::GetLink($this->image_id, ImagesType::normal)); case 'OriginalCode': return $this->code; case 'SizeLabel': return _xls_get_conf('PRODUCT_SIZE_LABEL', _sp('Size')); case 'ColorLabel': return _xls_get_conf('PRODUCT_COLOR_LABEL', _sp('Color')); case 'PageTitle': return _xls_truncate($this->GetPageMeta('SEO_PRODUCT_TITLE'), 70); case 'PageDescription': return _xls_truncate($this->GetPageMeta('SEO_PRODUCT_DESCRIPTION'), 255); default: return parent::__get($strName); } }
protected function GetImageLink($type) { return Images::GetLink($this->image_id, $type); }
/** * Ajax responder, when choosing a color from the dropdown, get product details to update page */ public function actionGetmatrixproduct() { if (Yii::app()->request->isAjaxRequest === false) { return; } $id = Yii::app()->getRequest()->getParam('id'); $strSize = Yii::app()->getRequest()->getParam('product_size'); $strColor = Yii::app()->getRequest()->getParam('product_color'); $objProduct = Product::LoadChildProduct($id, $strSize, $strColor); if ($objProduct instanceof Product) { $arrReturn['status'] = 'success'; $arrReturn['id'] = $objProduct->id; $arrReturn['FormattedPrice'] = $objProduct->getMarkedUpPrice(); $arrReturn['FormattedRegularPrice'] = $objProduct->SlashedPrice; $arrReturn['image_id'] = CHtml::image(Images::GetLink($objProduct->image_id, ImagesType::pdetail)); $arrReturn['code'] = $objProduct->code; $arrReturn['title'] = $objProduct->Title; $arrReturn['InventoryDisplay'] = $objProduct->InventoryDisplay; $arrReturn['FormattedSavingsAmount'] = $objProduct->getFormattedSavingsAmount(); $arrReturn['FormattedSavingsPercentage'] = $objProduct->getFormattedSavingsPercentage(); if ($objProduct->WebLongDescription) { $arrReturn['description_long'] = $objProduct->WebLongDescription; } else { $arrReturn['description_long'] = $objProduct->parent0->WebLongDescription; } if ($objProduct->description_short) { $arrReturn['description_short'] = $objProduct->WebShortDescription; } else { $arrReturn['description_short'] = $objProduct->parent0->WebShortDescription; } Yii::app()->clientscript->scriptMap['jquery.js'] = false; $arrReturn['photos'] = $this->renderPartial('/product/_photos', array('model' => $objProduct), true, false); } else { // options are missing so return the master product $objProduct = Product::model()->findByPk($id); $arrReturn['FormattedPrice'] = $objProduct->getFormattedSlashedPrice(); $arrReturn['FormattedRegularPrice'] = $objProduct->SlashedPrice; $arrReturn['FormattedSavingsAmount'] = $objProduct->getFormattedSavingsAmount(); $arrReturn['FormattedSavingsPercentage'] = $objProduct->getFormattedSavingsPercentage(); $arrReturn['code'] = $objProduct->code; $arrReturn['title'] = $objProduct->Title; $arrReturn['InventoryDisplay'] = $objProduct->InventoryDisplay; if ($objProduct->WebLongDescription) { $arrReturn['description_long'] = $objProduct->WebLongDescription; } if ($objProduct->description_short) { $arrReturn['description_short'] = $objProduct->WebShortDescription; } $arrReturn['photos'] = $this->renderPartial('/product/_photos', array('model' => $objProduct), true, false); } echo json_encode($arrReturn); }
public function getUploadPhotoFeed($objProduct) { $url = Images::GetLink($objProduct->image_id, ImagesType::normal, true); //If our URL is schema-less, prepend schema so Amazon is happy if (substr($url, 0, 2) == '//') { $url = "http:" . $url; } $strFeed = '<?xml version="1.0" encoding="utf-8" ?> <AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amznenvelope.xsd"> <Header> <DocumentVersion>1.01</DocumentVersion> <MerchantIdentifier>' . $this->MerchantID . '</MerchantIdentifier> </Header> <MessageType>ProductImage</MessageType> <Message> <MessageID>1</MessageID> <OperationType>Update</OperationType> <ProductImage> <SKU>' . $objProduct->code . '</SKU> <ImageType>Main</ImageType> <ImageLocation>' . $url . '</ImageLocation> </ProductImage> </Message> </AmazonEnvelope>'; Yii::log("Created photo feed " . $strFeed, 'info', 'application.' . __CLASS__ . "." . __FUNCTION__); return $strFeed; }