magento-1.4

Magento category ID from product ID

与世无争的帅哥 提交于 2019-11-29 07:22:06
In magento how to get the category id of each product from its product ID. $items = $request->getAllItems(); $c = count($items); for ($i = 0; $i < $c; $i++) { if ($items[$i]->getProduct() instanceof Mage_Catalog_Model_Product) { if ($items[$i]->getProduct()->getId()) { $this->_dhlAllowed = false; } } } Here $items[$i]->getProduct()->getId() returns product ID. I want its category ID. public function getProductCategory() { /* @var $product Mage_Catalog_Model_Product */ $product = Mage::registry('current_product'); if ($product->getId()) { $categoryIds = $product->getCategoryIds(); if (is_array(

Magento - get rule from coupon code

喜你入骨 提交于 2019-11-29 03:47:44
问题 I have to retrieve the rule associated to a coupon code in order to display in quote the discount percentage of that rule. the simplest way is to calculate directly from quote amounts, but i want to retrieve directly the rule and then get the discount percentage from it. this is what i tried: $rule = Mage::getModel('salesrule/coupon'); $rule->load($couponCode); by this way i still havent retrieved rules attributes. any help? thanks. 回答1: To load a coupon by code, pass 'code' as 2nd param to

filtering product collection on “is_salable”

本小妞迷上赌 提交于 2019-11-29 03:06:07
问题 I would like to filter a product collection to show only items that are in stock. I thought this would be easy given that there's an attribute called 'is_salable' that is 1 (true) if it's in stock, 0 (false) if not. But no matter what I do, it doesn't work. Further, it seems to halt the execution of the query before it finishes. Here's some sample code: $this->_productCollection = Mage::getModel('catalog/product')->getCollection(); $this->_productCollection->addAttributeToSelect('*'); $this->

Service Temporarily Unavailable Magento?

邮差的信 提交于 2019-11-28 15:15:35
My application was working fine yesterday. I started my PC today. When I tried to start Magento I got this error message. Service Temporarily Unavailable The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later. I am not even able to open the admin page or see any sort of errors on the page. If I visit any URL of my Magento site I am getting the above output. How do I resolve this? elMarquis Check if there is a file called maintenance.flag and if so delete it . Magento 1.x : maintenance.flag file is in : magento root

How to convert standalone PHP files to Magento's MVC

大城市里の小女人 提交于 2019-11-28 11:58:20
问题 I have a task to convert the standalone PHP files to Magento's MVC. These PHP files were created by another developer. The code in the PHP file accesses the database, converts the result into JSONP format and forward it to the frontend developer. I don't have any knowledge of Magento's MVC. Is this task of conversion similar to the modules in the app/code/core/Mage in the Magento folder?? How can I do this? Is the magento MVC the same as the PHP MVC? I am including the php file that I need to

Magento - Adding a new column to sales_flat_quote_item and sales_flat_order_item

梦想与她 提交于 2019-11-28 05:09:14
I'm working with Magento version 1.4.1.1, and I want to save a value in sales_flat_quote_item table (and pass it to sales_flat_order_item ). I've found this tutorial , but I'm not sure if it's still relevant (to Magento version 1.4.1.1) since it talks about a table called sales_order , which I believe is now sales_flat_order and looks a bit different. Should this method still work? If so - Can I use it for sales_flat_quote_item and sales_flat_order_item and what entity_type_id should I put in the commend : `insert into eav_attribute('entity_type_id','attribute_code','attribute_model','backend

Can no longer add registration fields in Magento 1.4.2.0

狂风中的少年 提交于 2019-11-28 00:29:12
I have used this tutorial before for adding registration fields to the Magento registration page . It has always worked, but since I have upgraded to Magento 1.4.2.0 it no longer does. The attributes I add no longer show up under the customers information tab in the backend like it did before and are not getting saved. The attributes install into the database fine though. I thought maybe the config.xml part had changed but I checked it against the core customer one and the attributes are sill shown the same way: <flavour><create>1</create><update>1</update></flavour> Something must have

Service Temporarily Unavailable Magento?

雨燕双飞 提交于 2019-11-27 09:07:33
问题 My application was working fine yesterday. I started my PC today. When I tried to start Magento I got this error message. Service Temporarily Unavailable The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later. I am not even able to open the admin page or see any sort of errors on the page. If I visit any URL of my Magento site I am getting the above output. How do I resolve this? 回答1: Check if there is a file called

Magento - get a parent category and all sub-sub-categories

雨燕双飞 提交于 2019-11-27 07:09:37
问题 I have a single category, that has 2 subcategories. Within each of these categories, are 5 subcategories. Is there a way to get a list of all of these 10 sub-sub-categories? Thanks EDIT: Something like this: Main Category Sub_Cat_1 Cat_1 Cat_2 Cat_3 Sub_Cat_2 Cat_4 Cat_5 Cat_6 Wanting output like: Cat_1 Cat_2 Cat_3 Cat_4 Cat_5 Cat_6 Thanks 回答1: All answers so far load children categories in a loop which is generally bad practice and causes execution of many SQL queries where a single one

How to upgrade magento 1.4 1.1 to 1.7.0.2 [closed]

家住魔仙堡 提交于 2019-11-27 03:24:30
I have a magento site in 1.4.1.1 . Now i want to uprgade the site to magento 1.7.0.2 . I already did the following steps: 1.system->magento connet->magento connect manager 2.Then i enter the extension key as "magento-core/Mage_All_Latest" 3.Then pressed "Check for Upgrades" button. now my window is bleow: Then what i do next? So how can i do the upgarde using magento connect manager? How can i upgarde the magento site ? Anyone have the solution? My magento site in localserver. EDIT: Garp Informatica Database structure has major changes from 1.4.1.1 to 1.4.2 so you need to upgrade first to 1.4