magento分类下的博客

Magento - Retrieve products with a specific attribute value

piaoling  2011-06-14 18:20:30

28 down vote accepted Almost all Magento Models have a corresponding Collection object that can be used to fetch multiple instances of a Model. To instantiate a Product collection, do the following $collection = Mage::getModel('catalog/product')->getCollection(); Products are a Magento EAV style Model, so you'll need to add on any additional attributes that you want to return. $collection = Mage::getModel('catalog/product')->getCollection(); //fetch name and orig_price into data $collect......

类别 :  magento(258)  |  浏览(3950)  |  评论(0)

Load Category or Product By Attribute (SKU, Name etc) In Magento

piaoling  2011-06-14 15:56:25

Loading a Product/Category by an ID This is an easy one which we all know how to do, however, I will write it here anyway. ? 1 2 $_category = Mage::getModel('catalog/category')->load(4); $_product= Mage::getModel('catalog/product')->load(12); While loading by ID usually is all that’s needed, sometimes you will want to load a product or category by SKU or name, this is where loadByAttribute comes in. loadByAttribute($attribute, ......

类别 :  magento(258)  |  浏览(3363)  |  评论(0)

magento get data by attribute 通过属性获取实例

piaoling  2011-06-14 15:52:51

$orderId = Mage::getModel('sales/order')->loadByAttribute('entity_id',$orderEntity)->getData('increment_id');   $payment = Mage::getModel('sales/order_payment')->load($order->getId(), 'parent_id'); ......

类别 :  magento(258)  |  浏览(3088)  |  评论(0)

Magento Database

piaoling  2011-06-13 19:03:33

Magento Database Diagrams 1.0.x / 1.1.x / 1.2.x / 1.3.x   sample database diagram The above image is only a low-resolution diagram example. Actual high resolution Magento database diagrams can be downloaded here. The Magento "EAV" Data Model A short note regarding Magento database design: For purposes of flexibility, the Magento database heavily utilizes an Entity-Attribute-Value (EAV) data model. As is often the case, the cost of flexibility is complexity - Magento is no exception. The proces......

类别 :  magento(258)  |  浏览(3850)  |  评论(0)

Magento 核心类 Varien_Data_Collections 应用介绍

piaoling  2011-06-13 17:29:13

这节打算介绍一下Magento的Varien_Data_Collections,我从Alanstorm翻译过来的(部分翻译,读者也可以练一下英文能力) Varien Data Collections 这是什么东西?哈哈,你看完下面的文章,你就会知道它在Magento中的核心的作用了。 作为一个PHPer,如果想把一些一组相关的变量集合在一起有两个方法:Array 和自定义的数据结构,Varien_Object 就是后者。 首先介绍一下 Varien_Object 的使用方法:      $thing_1 = new Varien_Object();     $thing_1->setName('Richard');     ......

类别 :  magento(258)  |  浏览(3209)  |  评论(0)

在Magento System Configuration新增内容

piaoling  2011-06-13 17:27:07

Custom Magento System Configuration Magento之所以非常强大,一部分是由于它有非常强大的后台(Admin’s System Config section)配置能力。它允许开发者通过添加一些表单元素就可以配置Magento系统和用户新增的模块。 在我们刚开始在Magento中新增一些自定义的内容时,由于Magento自身原因(复杂但灵活),往往会望而生畏,但是当你着手去做的时候,你就会喜欢上它的灵活。 下面我们通过一个简单的例子来学习Magento System Configuration(system.xml). 例:新增一个module ......

类别 :  magento(258)  |  浏览(3482)  |  评论(0)

Magento CMS 应用实例

piaoling  2011-06-13 17:08:00

下面是一些CMS的应用实例: e.1-magento 页面中加入CMS static block   在magento的模版中有些内容想通过后台来控制,那么你可以将这些html css js 放在CMS的static blocks中,然后用下面的代码来在前台输出 写到phtml文件里的的PHP代码如下:   Php代码   <?php    echo $this->getLayout()->createBlock('cms/block')->setBlockId('your_block_Identifier')->toHtml()    ?>      其中setBlockId('your_block_Identifier')的参数your_block_Identifier......

类别 :  magento(258)  |  浏览(3683)  |  评论(0)

setSaveParametersInSession() on a non-object on cache page

piaoling  2011-05-19 16:43:40

Magento error:setSaveParametersInSession() on a non-object on cache page     查找日志,找出错误: exception: 2011-05-19T08:48:24+00:00 ERR (3): exception 'Mage_Core_Exception' with message 'Invalid block type: Bysoft_Storelocation_Block_Adminhtml_Storelocations' in D:\wamp\www\jflazartigue\1510\app\Mage.php:550 Stack trace: 2011-05-19T08:50:24+00:00 ERR (3): exception 'Mage_Core_Exception' with message 'Invalid block type: Bysoft_Storelocation_Block_Adminhtml_Storelocation_Grid' in D:\wamp\www\jflazartigue\1510\app\Mage.php:55......

类别 :  magento(258)  |  浏览(3693)  |  评论(0)

Viewing the Registry Contents in Magento

piaoling  2011-05-19 10:04:11

The Magento registry is a globally accessible store of data that is used by all aspects of the Magento system. Recently a user asked me how to see the contents of the registry. After a little play I found a way to do this, however, be warned: to accomplish this you need to temporarily modify a core Magento file (Mage.php). Read on for more information Mage.php and the Mage class The main file of Magento is a file called Mage.php and is stored inside the app folder. This class contains a lot of useful functions which you will probably notice. Most of these functions are static which......

类别 :  magento(258)  |  浏览(3692)  |  评论(0)

The Magento Registry

piaoling  2011-05-19 10:01:04

The Magento registry provides an easy way for objects to share information, without actually have to know about each other. In short, it is basically an array that can be accessed anywhere in Magento because it is a static function. If you’re not sure what a static function is, let me explain. Non-static functions, or dynamic functions cannot be called on an object that hasn’t been instantiated as they need an instance of the class to function. Static functions differ in that these can be called with the object being instantiated. To call a static function we use the format Cla......

类别 :  magento(258)  |  浏览(3344)  |  评论(0)
  • Page:16/26  258 Blogs
    <<
    >>
    20088
    周日 周一 周二 周三 周四 周五 周六

    文章分类