在magento外获取订单信息
下载文件aaa.rar解压可以得到aaa.php,丢入magento根目录就可以运行,使用http://www.domain.com/aaa.php?orderid=10000XXXX,的格式就可以的到相应的订单信息。
查看全文...
下载文件aaa.rar解压可以得到aaa.php,丢入magento根目录就可以运行,使用http://www.domain.com/aaa.php?orderid=10000XXXX,的格式就可以的到相应的订单信息。
magento的Api默认就有更新产品图片的功能,今天将我自己测试的代码共享下,供大家学习参考。本次使用magento 1.5版Api,其它版本可能稍有不同。 //省略初始化Api过程,见我的其余magento API文章 www.hellokeykey.com // 产品图片 // 初始化产品图片信息,注意自己上传个产品图片到magento的产品图片文件夹 // $imagePath为图片路径,如果你使用相对路径,注意测试下是正确 // label为图片的alt属性 // position 为图片的显示顺序 // type 为此图片作为’thumbnail’,’small_image’,’image’中的哪一个 // mime为图片类型 $imagePath = “http://www…….magento/media/catalog/product/h/t/htc-touch-diamond.jpg”; //产品图片路径 $newImage = array( ‘file’ => array( ‘name’ => ‘file_name’, ‘content’ => base64_encode(file_get_contents($imagePath)), ‘mime’ => ‘image/jpeg’ ), ‘label’ => ‘Cool Image Through Soap’, ‘position’ => 1, ‘types’ => array(‘thumbnail’, ‘small_image’, ‘image’), [...]
添加在前面 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT; SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS; SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION; SET NAMES utf8; SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=’NO_AUTO_VALUE_ON_ZERO’; SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0; 添加在后面 SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT; SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS; SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION; SET SQL_NOTES=@OLD_SQL_NOTES;
1. 添加方法在 Mage_Catalog_Block_Product_List: app/code/core/Mage/Catalog/Block/Product/List.php: //… /** * Use this method in layouts for extra attributes * * @param string $code internal name of attribute */ public function addAttribute($code) { $this->_getProductCollection()->addAttributeToSelect($code); return $this; } 2.? 更新布局文件layout/catalog.xml <layout> <!– … –> <catalog_category_default> <!– … –> <block type=”catalog/product_list” name=”product_list” template=”catalog/product/list.phtml”> <!– START UPDATE –> <action method=”addAttribute”><name>MyAttribute</name></action> <action method=”addAttribute”><name>AnotherCustomAttribute</name></action> [...]
The function addAttributeToFilter can be called on a product collection in Magento. In short, it adds a condition to the WHERE part of the MySQL query used to extract a product collection from the database. This is helpful when you need to filter your product listing result for some requirement such as showing featured products [...]