magento分类下的博客

How to get access of magento core functions from outside the magento directory

piaoling  2011-07-14 18:34:42

This is the very important thing in magento while accessing data from outside of the magento, You also can use it to set cron job of any magento function, as cron job doen't work properly in magento. require_once 'app/Mage.php'; // if your are not root folder then write the proper path like publichtml/magento/app/Mage.php Mage::app('default'); Now you can create object of any classes and can access methods of those classes also. Like the Below example $obj = new Mage_Checkout_Model_Observer(); echo $obj->salesQuoteSaveAfter(); ......

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

How to get all cart items from cart session in magento

piaoling  2011-07-14 18:32:55

How to get all cart items from cart session in magento   This is one of the most usefull features for all magento developers.As it's very necessary while anybody working on Magento cart or checkout page.To get all cart item from cart session write the below code $session= Mage::getSingleton('checkout/session'); foreach($session->getQuote()->getAllItems() as $item) {    $productid = $item->getProductId();    $productsku = $item->getSku();    $productname = $item->getName();    $productqty = ......

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

How to Remove Product from cart on checkout page or by coding in magento

piaoling  2011-07-14 18:24:43

From magento cart you can delete product by clicking on delete button from cart page , but if you wish to delete any cart item in checkout page or by coding then you have write $session= Mage::getSingleton('checkout/session'); $quote = $session->getQuote(); $cart = Mage::getModel('checkout/cart'); $cartItems = $cart->getItems(); foreach ($cartItems as $item) {     $quote->removeItem($item->getId())->save(); } By writing the above code your all cart item will be delete.If you wish to delete a particular product from the cart session then ......

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

How to send Email in magento

piaoling  2011-07-14 18:04:23

Any body can send mail using php mail() function.But in magento all the functionality has wriiten you need to just send argument inside those functions. See the following code to send mail using magento function <?php $mail = Mage::getModel('core/email'); $mail->setToName('Your Name'); $mail->setToEmail('Youe Email'); $mail->setBody('Mail Text / Mail Content'); $mail->setSubject('Mail Subject'); $mail->setFromEmail('Sender Mail Id'); $mail->setFromName("Msg to Show on Subject"); $mail->setType('htm......

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

get skin url, get js url, get media url, get store url ,get base url in magneto

piaoling  2011-07-14 17:23:47

  These are the following methods to get Magento Base Url, Magento Skin Url, Magento Media Url, Magento Js Url.to get all write the following code Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK); or you can write $this->getUrl(); e.g:- http://yoursite.com/index.php/ Get Magento Media Url Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); e.g:- http://yoursite.com/media/ Get Magento Skin Url Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); or you can write $this->getSkinUrl(); e.g:- http://yoursite.com/skin/ Get Magento Store Ur......

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

Magento 重写总结 (三)

piaoling  2011-07-13 16:18:10

前面两篇文章, 我们主要介绍如何对magento核心文件进行重写, 但是如果一个第三方模块已经对某个magento核心文件进行了重写, 因为某种原因, 我们需要扩展另一个模块, 同时这个模块也要对同一核心文件进行重写, 那该怎么办? 今天我们将针对这种情况, 进行详细的探讨, 首先假设这个第三方模块名字叫Matrix_Catalog, 它主要目录结构应该如下: app/code/local/Matrix/Catalog app/code/local/ Matrix /Catalog/etc app/code/local/ Matrix /Catalog/Model app/code/local/ Matrix /Catalog/Bloc......

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

Magento 重写总结 (一)

piaoling  2011-07-13 16:16:34

记得有篇关于《Magento开发者最容易出现的3个错误》文章里面提到的一点就是——-修改 Magento 的核心文件, 这是很多新的magento开发者最容易犯的一个毛病, 一旦修改了magento的核心文件,以后如果要对magento进行升级, 那将是一个恶梦, 同时,也容易造成不同模块间的冲突, 背离magento模块之间低耦合的设计思想。 今天, 我们一起来回顾一下,如何对magento的model, block, controller 进行重写 首先, 我们要创建一个新的module, 具体方法可以参......

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

Magento 重写总结(二)

piaoling  2011-07-12 16:27:12

在上一篇文章里, 我们着重介绍了对magento常规的model, block和controller的重构, 其中model和block类的重载都比较简单,直接复制一个,按照相同的目录格式放到local下就可以了, 但是如果对controller和config文件进行重构就要麻烦些了. 今天介绍一种针对adminhtml的controller的简单重构方法,假设我们需要针对report扩展一种新的报表, 那么我们需要正对report的controller进行重构: 1. 先创建自己的module,parkage的名字定为Matrix,模块为Report. 该模块的目录结构应该为......

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

directly manage tables

piaoling  2011-07-12 13:26:19

$query = 'SELECT *'             .' FROM '.Mage::getModel('core/config_data')->getTablePrefix().'sales_order_status_state AS soss'             .' WHERE soss.state = ? AND soss.status = ?';         $row = Mage::getSingleton('core/resource')->getConnection('core_read')->query($query, array($state, $status))->fetch();         if( ! $row) {         ......

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

magento shippping set

piaoling  2011-07-07 13:34:09

 require_once 'Mage/Checkout/controllers/CartController.php'; class Bysoft_Homepage_Checkout_CartController extends Mage_Checkout_CartController {     public function indexAction()     {         if (Mage::app()->getStore()->getCode()=='jf_lazartigue_fr_fr'){             $this->_getQuote()->getShippingAddress()                 ->setCountryId('FR')    ......

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

    文章分类