//remove product images:
public function remove_image_files($_product_id) { if ($_product_id) { $simple_product = Mage::getModel('catalog/product')->load($_product_id); //clean all product images; $mediaApi = Mage::getModel("catalog/product_attribute_media_api"); try { $items = $mediaApi->items($simple_product->getId()); foreach($items as $item) { echo ($mediaApi->remove($simple_product->getId(), $item['file'])); } } catch (Exception $exception){ var_dump($exception); die('Exception Thrown'); } } }
//add image to product
public function import_image($_product_id,$config_sku,$config_label) { if ($_product_id) { $simple_product = Mage::getModel('catalog/product')->load($_product_id); //import product images $importDir = $this->_file_path .$config_sku.DS . $config_label . DS; $i = 0; foreach ($this->_image_arr as $imageType=>$fileName) { var_dump($imageType); $filePath = $importDir.$fileName; var_dump($filePath); ++$i; if (file_exists($filePath)) { try { $simple_product->addImageToMediaGallery($filePath, array($imageType), false, false); var_dump('save image:' . $filePath .' successed!'); } catch (Exception $e) { echo $e->getMessage(); } } else { var_dump('Not Found Image for :' . $config_sku.'-'. $config_label . ' ' . $imageType); } } try { $simple_product->save(); }catch (Exception $e) { echo $e->getMessage(); } } }
相关推荐
Ajax-Magento-ajax-add-to-cart.zip,[模块magento 1]magento ajax添加到购物车-ajoter vos produits au panier en ajax/感谢ajax将您的产品添加到购物车,ajax代表异步javascript和xml。它是多种web技术的集合,包括...
Apress.The.Definitive.Guide.to.Magento.Dec.2009.pdf Apress于2009重磅推出的Magento上手书籍,原书地址:http://www.apress.com/book/view/9781430272298
magento入门原版书.。。The Definitive Guide to Magento.pdf
compared to Magento 1. Where Magento 1 could be installed through FTP or SSH, Magento 2 is installable only via the command-line interface for an experienced webmaster. Chapter 2, Magento 2 System ...
magento2在产品详情添加自定义tab,1. Enable module with php bin/magento ...General settings will include the following options to configure:....Go to Catalog -> Tab Management menu -> click Add New Tab.
What this book covers Chapter 1, Installing Magento 2 on Apache and NGINX, is a ... It also includes how to add unit/functional tests as this is a new requirement for extensions listed on the new Magento
Do you have a good product to sell but need a way for your start-up to sell it to your potential customers the right way? Were you unhappy with what Magento 1 had to offer and are looking forward to ...
原理部分是一个新的图像适配器(一个既实现Magento\Framework\Image\Adapter\AdapterInterface并从Magento\Framework\Image\Adapter\AbstractAdapter扩展的类)。 这将消除使用图像处理功能或执行操作的所有方法。 ...
magento数据结构分析 magento数据字典
演示地址:http://olegnax.com/product/athlete-responsive-magento-theme/livepreview/ Athlete Magento主题,兼容Magento 1.9.x, 1.8.x, 1.7.x ,特点:完全自适应(响应式布局),自定义子主题,无限颜色,完全...
NULL 博文链接:https://hudeyong926.iteye.com/blog/1728074
产品图像清洁器 [M2] ...composer config repositories.hs-module-image-clean vcs https://github.com/hungersoft/magento2-image-clean.git composer require hs/module-image-clean:dev-master php
magik shoes magento 模板, magento 1.7 模板
Magento 2 Docker开发Apache 2.4 + PHP 7.1 + OPCache + MariaDB + N98 Magerun 2 + XDebug + Redis要求苹果系统: 安装 , 和 。 视窗: 安装 , 和 。 Linux: 安装和 。如何使用在您的终端中执行,更改MYMAGENTO2...
magento的SMTP插件magento的SMTP插件magento的SMTP插件
Get a hands-on introduction to custom shipping and payment methods ☆ 出版信息:☆ [作者信息] Branko Ajzele [出版机构] Packt Publishing [出版日期] 2013年09月25日 [图书页数] 128页 [图书语言] 英语...
深入理解Magento 由精东博客下载下来制作成pdf
NULL 博文链接:https://justcoding.iteye.com/blog/2100394
Magento插件开发手册 Magento Extension Developers Guide