
Magento
文章平均质量分 60
iteye_14261
这个作者很懒,什么都没留下…
展开
-
清空所有分类和商品的SQL语句
TRUNCATE TABLE `catalog_product_bundle_option`;TRUNCATE TABLE `catalog_product_bundle_option_value`;TRUNCATE TABLE `catalog_product_bundle_selection`;TRUNCATE TABLE `catalog_product_entity_dat...2013-05-15 09:49:45 · 353 阅读 · 0 评论 -
添加自定义字段到后台订单列表和订单导出
1.在本地目录创建Grid文件,用于覆盖后台订单列表的Grid<?php/** * Magento * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package ...2013-06-13 13:32:11 · 566 阅读 · 0 评论 -
查找同一可配置关联的存在不用属性组名的简单商品的SKU
<?phprequire_once 'abstract.php';class Mage_Shell_DifferentSizeSearch extends Mage_Shell_Abstract{ /** * Run script * */ public function run() { ...2013-06-17 11:54:57 · 114 阅读 · 0 评论 -
get magento module config data in Observer
$config = Mage::getStoreConfig('section_name/group/field'); //value$config = Mage::getStoreConfig('section_name/group'); //array原创 2013-07-04 09:52:13 · 82 阅读 · 0 评论 -
一个门店省市店名三级联动
首先看一下三个按钮,是用UL LI标签 展示,并且用一个隐藏的元素进行记录:<div class="store_select"> <?php $provinces = $this->getAllProvince();?> <?php echo $this->__('请前往')?> <ul name="sto...2013-10-18 13:57:14 · 190 阅读 · 0 评论 -
统计每N个小时的人头和订单商品(ITEM)
INSERT INTO `alsobuy_order_item` (`person`,`product_id`,`times`) SELECT * FROM ( ( SELECT CONVERT(o.customer_id,CHAR) AS `person`, oi.product_id, FLOOR(UNIX_TIMESTAMP(DATE_FORMAT(o...原创 2013-11-15 14:04:03 · 132 阅读 · 0 评论 -
Add Related Product
/** * 添加关联商品到指定商品 */ public function addRelatedProducts($product_id,$skus) { $param = array(); foreach ($skus as $key=>$sku) { $related_product = Mage::...2013-11-22 16:20:21 · 167 阅读 · 0 评论 -
Import Product Images
/** * 导入某个商品图片,先清空再导入 * @param unknown $images 远程图片地址数组 * @param unknown $sku 商品sku. */ public function importProductImages($images,$sku) { //remove All images $product = Mage::g...原创 2013-11-22 16:23:23 · 170 阅读 · 0 评论 -
add category programmly
只展示一级目录的导入$root_cate_id = 2;if (!$this->existsCate(trim($row['mid']))) { $cate = new Mage_Catalog_Model_Category(); $cate->setName($name); $cate->setUrlKey(trim($row['mid'])); $...2013-11-22 16:32:51 · 174 阅读 · 0 评论 -
import simple product
public function importOnlySimpleProduct() { $read= Mage::getSingleton('core/resource')->getConnection('core_read'); $sql = "SELECT `mid` AS `product_id` FROM `old_data_import` WHER...2013-11-22 16:36:48 · 115 阅读 · 0 评论 -
import one option simple product and config product
只有一种选项的简单商品和可配置商品 例如:某鞋子有尺寸这一可选项: (尺码:35,36,37,38,39)主要是先创建5个拥有者写属性值的简单商品然后创建一个可配置商品。配置好可配置商品的配置项,将简单商品关联到这个可配置商品 /** * 导入有option value 的简单商品 */ public function importMixProduc...2013-11-22 16:41:11 · 122 阅读 · 0 评论 -
import newsletter subscriber email list
public function addOld() { $read= Mage::getSingleton('core/resource')->getConnection('core_read'); $sql ="select * from `old_newsletter` where status = 0"; $results ...原创 2013-11-23 12:00:01 · 243 阅读 · 0 评论 -
import product programmly
public function addCustomer($data) { Mage::app()->setCurrentStore(1); $websiteId = 1; $store = Mage::app()->getStore(); if (!$this->customerExists($data['email'])) ...原创 2013-11-23 12:00:41 · 107 阅读 · 0 评论 -
import two option simple - config product
这个比较麻烦。有两个可配置想例如一种鞋子有(尺寸:35,36,37,和颜色:红,黄,蓝)那么它就有3*3=9种简单商品,还有一个可配置商品 public function importDoubleMixProduct() { //获取这种类型的商品ID; $read= Mage::getSingleton('core/resource')->getConne...原创 2013-11-23 12:01:08 · 121 阅读 · 0 评论 -
update Has Image Simple Product Visibility
require_once 'abstract.php';/** * Magento Compiler Shell Script * * @category Mage * @package Mage_Shell * @author Magento Core Team <core@magentocommerce.com> */c...原创 2013-11-28 09:33:45 · 109 阅读 · 0 评论 -
Clean special price when special price equal to price
class Mage_Shell_CleanSpcialPrice extends Mage_Shell_Abstract{ /** * Run script * */ public function run() { $collection = Mage::getModel('catalog/...2013-11-28 09:35:58 · 127 阅读 · 0 评论 -
Configurable attribute option pricing
如上图所见的配置。 说明这个可配置商品的可变价格属性是数量。和颜色属性无关。当数量是2个的时候它会价格有变化。 它是Magento内置的功能,这样配置后前台可以再选择不同的option value的时候使得价格发生变化。 而控制这部分数据的。是这张表:SELECT * FROM catalog_product_super_attribute_pricing...2013-12-03 15:42:11 · 127 阅读 · 0 评论 -
Using Jquery Ajax in Magento + Ajax Header Sidebar
在topmenu.phtml文件里。增加以下JS.(function($){ $.ajax({ url: "<?php echo $this->getUrl('checkout/cart/headcount');?>", type: "POST", dataType:"json", ...原创 2013-12-04 11:20:57 · 113 阅读 · 0 评论 -
remove "Choose an Option...“ in config product detail page attribute option
<script>spConfig.setInitialState = function(dropdown_id) { //select dropdown var dropdown = $(dropdown_id); //remove empty option from dropdow...原创 2013-12-05 17:07:21 · 115 阅读 · 0 评论 -
remove price add and sub in option select box
<script type="text/javascript">// <![CDATA[ jQuery(document).ready(function(e) { checkoptions(); jQuery("select.super-attribute-select").change(function(){ ...原创 2013-12-05 17:15:35 · 77 阅读 · 0 评论 -
export category list
class Mage_Shell_ExportCategory extends Mage_Shell_Abstract{ /** * Run script * */ public function run() { ini_set("memory_limit","1000M"); umask(0);...2013-12-09 11:07:43 · 188 阅读 · 0 评论 -
remove lastname validation in checkout
1.要覆盖原生验证类,先定义在config文件里:<models> <customer_address> <rewrite> <abstract>Bysoft_Mycustomer_Model_Address_Abstract</abstract>...2013-12-17 10:49:51 · 122 阅读 · 0 评论 -
Change Order Status after create invoice
1.在模块的config.xml中定义触发事件: <events> <sales_order_invoice_save_commit_after> <!-- identifier of the event we want to catch --> <observers> <sales_ord...2013-12-30 17:35:57 · 139 阅读 · 0 评论 -
add comment field in checkout page
1.在order view或者billing页面加入HTML原件<li> <label for="orderComment"><?php echo $this->__('Comments'); ?></label> <textarea name="orderComment" id="order2013-12-30 23:07:19 · 309 阅读 · 0 评论 -
Programatically create a magento ‘Yes/No’ product attribute
$this->addAttribute( Mage_Catalog_Model_Product::ENTITY, 'yes_no_attribute', array( 'group' => 'General', 'type' => 'tinyint', 'backend' => '', ...2014-01-06 14:27:23 · 105 阅读 · 0 评论 -
create coupon programmlly
1.准备好coupon code数据表放到 $file_path = BP . DS . 'media' .DS . 'coupon' . DS . 'coupon.csv'; 2.执行以下shell代码php shell/importCoupon.php <?php/** * Magento * * NOTICE OF LICENSE * ...2014-01-10 16:00:50 · 163 阅读 · 0 评论 -
Rewrite Magento Core Front Controller Action
目标,覆盖Mage_Customer_AddressController类的formPostAction方法 首先,在config.xml内定义路由规则以及要集成的module和现有module<config>//... <frontend> <routers> <customer>...2014-01-16 10:42:02 · 83 阅读 · 0 评论 -
Batch Set Customer Default Billing Address as Shipping Address
public function run(){ //search all customer. $collection = Mage::getModel("customer/customer")->getCollection()->addAttributeToSelect("*"); //->addFieldToFilter("email",'bobo.wang...2014-01-16 11:33:45 · 223 阅读 · 0 评论 -
Add To Cart Programmlly
<?php class Bysoft_Mycheckout_Model_Addtocart{ /** * When occur FATAL ERROR, it will redo the run function * @param unknown $i */ public function shutdown($i) { var_dump('alr...2014-01-30 09:26:08 · 213 阅读 · 0 评论 -
Magento 1.8 Clean All Categories And Products By Sql
SET FOREIGN_KEY_CHECKS = 0;TRUNCATE TABLE `catalog_product_bundle_option`;TRUNCATE TABLE `catalog_product_bundle_option_value`;TRUNCATE TABLE `catalog_product_bundle_selection`;TRUNCATE TA...2014-02-19 15:18:04 · 111 阅读 · 0 评论 -
Shutown Function In Model
// 如果遇到什么严重错误重新向跳转到某个页面// 范例中是连接一个ERP API时出错 public function shutdown() { var_dump('already shutdown.'); $last_error = error_get_last(); var_dump($last_error); if (stripos($last...2014-02-20 11:09:17 · 122 阅读 · 0 评论 -
get child category from flat data
Fatal error: Call to undefined method Mage_Catalog_Model_Resource_Category_Flat_Collection::joinUrlRewrite() This happens because the category model (catalog/category) uses different resource model...原创 2014-02-21 16:59:05 · 109 阅读 · 0 评论 -
Add Shipment to Adminhtml Order List Grid
1. rewrite the grid block file<global> <blocks> <adminhtml> <rewrite> <sales_order_grid>Raveinfosys_Deleteor...原创 2014-02-27 10:58:10 · 220 阅读 · 0 评论 -
Add Custom Field to Static Block Edit Page
范例是对后台Static Blocks 编辑页面增加两个时间字段Start time 和End Time 1.在模块升级文件中添加两个字段到cms/block表$installer->getConnection()->addColumn($installer->getTable('cms/block'), 'start_time', 'datetime')...2014-02-27 17:25:13 · 106 阅读 · 0 评论 -
create rma by rma item
/** * Customer create new return */ public function createAction() { $orderId = (int)$this->getRequest()->getParam('order_id'); $order = Mage::getModel('sales/order')...原创 2014-03-11 11:52:22 · 151 阅读 · 0 评论 -
[翻譯] Payment Gateway Intergration
原文地址http://www.magentocommerce.com/wiki/5_-_modules_and_development/payment/create-payment-method-module 介紹每個支付接口方法可以被做成一個獨立的Module,一些方法可以被合並到同一個Module ,因為有可能他們共享相同的功能。讓我們創建一個Module,它有一個支付方...2014-03-20 10:51:07 · 183 阅读 · 0 评论 -
add attribute group and create new attribute to this group
//for example:// I will add a attribute group named 'Vendor' to 'Default' attribute setfunction addAttributeGroup($group_name, $attrSetName,$sort_order) { $modelGroup = Mage::getModel('eav/enti...2014-04-10 14:54:10 · 113 阅读 · 0 评论 -
Add option to dropdown attribute
public function attributeValueExists($arg_attribute, $arg_value) { $attribute_model = Mage::getModel('eav/entity_attribute'); $attribute_options_model= Mage::getModel('eav/entity_attr...原创 2014-04-11 14:09:49 · 95 阅读 · 0 评论 -
set Tier Prices programmly
//tire price $tierPrices[] = array( 'website_id' => 0, 'cust_group' => 32000, 'price_qty' => $row['qty_1'], 'price' => $row['price_1'] )...原创 2014-04-15 10:52:15 · 121 阅读 · 0 评论 -
Add column to exists table using upgrade script
<?php $installer = $this;$installer->startSetup();try { $table = $installer->getTable('awrma/entity'); $conn = $installer->getConnection(); $conn->addColumn($table, 'author...2014-04-17 12:41:44 · 84 阅读 · 0 评论