Category: WP / Joomla! / Magento / Shopify / Drupal / Moodle / Zimbra

Magento: 产品页面下jquery change函数失效 Call javascript function onchange product option on Magento product page

明显的原因是change函数跟magento默认的onchange函数冲突。 一个方法是编辑 /js/varien/configurable.js  文件 : Place call to your function just above return; in function reloadPrice: function() 另一个不修改核心文件的方法是: Try $(document).on('change','#multiid',function(){ alert('Change Happened'); }); As your select-box is generated from the code, so you have to use event deleg… Read More

Magento: 判断是否为手机浏览 Optimise Web’s Mobile Detect Class for Magento

项目地址:Optimise Web’s Mobile Detect Class for Magento Optimise Web’s Mobile Detect Class for Magento MobileDetect.net is a lightweight PHP class for detecting mobile devices. Optimise Web’s Magento extension allows using Mobile Detect’s functions from within Magento. Usage Mage::helper(‘mobiledetect’)-… Read More

Magento: addAttributeToFilter 和 addFieldToFilter 的区别 Difference between addAttributeToFilter and addFieldToFilter

addAttributeToFilter is used to filter EAV collections and will filter the products based on the attributes that you’ve included in your collection. EAV-models: product, customer, sales, etc. addFieldToFilter is used to filter Non-EAV collections and will filter the products based on columns in the database from the table catalog_product_en… Read More

Magento : 调用文件上传 upload file frontend

bool mkdir ( string $pathname [, int $mode = 0777 [, bool $recursive = false [, resource $context ]]] ) $pathname should be the server path to the file and not a url Try $path = Mage::getBaseDir('media') . DS; You should try using Varien_File_Uploader include_once Mage::getBaseDir() . '/lib/Varien/File/Uploader.php'; /* Starting upload */ $uploader = n… Read More

Magento: 自定义用户登录导向页面 Redirect Customer to Previous Page After Login

Configuration Settings – Login to admin panel – Go to System -> Configuration -> CUSTOMERS -> Customer Configuration -> Login Options – Set: Redirect Customers to Account Dashboard after Loggin in = No – You can see in comments for this field: Customer will stay on the current page if “No” is selected. This setting will redirect customers to the…

Magento: 代替flash上传 How to disable Flash uploader in Magento (product images and WYSIWYG)

1. 替换产品页flash上传按钮 – 使用 Dull_Uploader How to disable Flash uploader in Magento 1.4.x – 1.9.x So what to do if one day you will discover that you simply cannot upload any images in your Magento administration panel due to Flash problem? Don’t panic, just follow these simple steps: 1. Find the Dull_Uploader (No Flash Image Uploader) module…

Magento: 在客户账户中添加自定义链接 My Account Add Link

This extension add new link and a page to that link and enable/disable links in my account left Nav section. 页面: https://www.magentocommerce.com/magento-connect/my-account-add-link.html Magento Connect 2.0 : http://connect20.magentocommerce.com/community/ng_customer 下载:  ng_customer-1.0.2—-customer-account-page   本文: M… Read More

Magento: 根据产品属性加载产品信息 Load A Category or Product by an Attribute

Load a Product by ID <?php // get product model by product id, assuming you have known product id, $productId $_product = Mage::getModel('catalog/product')->load($productId) Load a Product by SKU <?php $sku = 'my-product-sku'; $product = Mage::getModel('catalog/product')->load($sku, 'sku'); if ($product->getId()) { echo $pr… Read More

Magento模块开发之数据库SQL操作方法说明

今天主要来看Magento中的Mysql4/Resource(资源) 如何对数据库进行操作, 来执行更为复杂的 sql 语句。 在Magento中Model 通常都会继承 Mage_Core_Model_Abstract, 而这个 Abstract 又继承了Varien_Object, 在 Abstract 类中包含许多常用的方法,例如: getId(), load(), save(), delete() 等等…而 Mysql4/Resource Model 则继承 Mage_Core_Model_Mysql4_Abstract, 而这个 Abstract 又继承了 Mage_Core_Model_Resource_Abstract SQL 和 My… Read More

Magento: 通过id获取类别名字等信息 get category by id

<?php // get category model by category id, assume you have known category id, $categoryId $_category = Mage::getModel('catalog/category')->load($categoryId); // category name $categoryName = $_category->getName(); // category description $categoryDescription = $_category->getDescription(); // category url $categoryUrl =… Read More

Magento事件与事件监听

事件和事件监听也许是magento中最有趣的功能之一,因为它允许开发者来扩展magento应用程序中的关键部分。 为了为不同模块之间提供更多的灵活性和便利,magento使用了一种事件/监听模式,这种模式允许模块之间进行松散耦合。 在这个系统中有两部分,一部分是事件分发对象和事件信息,另一部分是监听特定的事件。 一、事件分发 事件的创建和分 发使用Mage::dispatchEvent() 函数。核心团队已经在一些核心关键部分创建了一些事件,例如,模型抽象类Mage_Core_Model_Abstract 在一个模型每次保存的时候调用了两个protected函数—— _beforeSave() 和_afterS… Read More

Magento: 获取类别所有子类别 (无限级别-目录树) Get All Sub Categories

生成分类目录树(Category Tree) $rootcatId = Mage::app()->getStore()->getRootCategoryId(); $categories = Mage::getModel('catalog/category')->getCategories($rootcatId); function get_categories($categories) { $array = '<ul>'; foreach ($categories as $category) { $cat = Mage::getModel('catalog/category')->load($ca… Read More