本文整理汇总了PHP中Ess_M2ePro_Model_Magento_Product::getGalleryImagesLinks方法的典型用法代码示例。如果您正苦于以下问题:PHP Ess_M2ePro_Model_Magento_Product::getGalleryImagesLinks方法的具体用法?PHP Ess_M2ePro_Model_Magento_Product::getGalleryImagesLinks怎么用?PHP Ess_M2ePro_Model_Magento_Product::getGalleryImagesLinks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ess_M2ePro_Model_Magento_Product
的用法示例。
在下文中一共展示了Ess_M2ePro_Model_Magento_Product::getGalleryImagesLinks方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: getGalleryImagesLinks
public function getGalleryImagesLinks($limitImages = 0)
{
$cacheKey = array(__METHOD__, func_get_args());
if ($this->isCacheEnabled && !is_null($cacheResult = $this->getCache()->getData($cacheKey))) {
return $cacheResult;
}
return $this->getCache()->setData($cacheKey, parent::getGalleryImagesLinks($limitImages));
}