magento-1.4

Mark a Magento order as complete programmatically

寵の児 提交于 2019-12-03 14:04:35
I'm trying to mark a "Processing" order as Complete when I get a certain response back from a third party service. I've got everything set up for this, but the only problem is that orders are staying in the Processing state. I'm generating an invoice (I don't think I need this though, as each item is marked as "invoiced" in the Magento backend) and a shipment like so: $order = Mage::getModel('sales/order')... (etc) $shipment = $order->prepareShipment($quantities); $shipment->register(); $shipment->setOrder($order); $shipment->save(); $invoice = $order->prepareInvoice($quantities); $invoice-

Module and ajax call

北慕城南 提交于 2019-12-03 12:32:00
问题 I'm trying to create an ajax call to a custom controller. I've been following: http://www.atwix.com/magento/ajax-requests-in-magento/ - which gives a brief example of how to create. So I have the following files: app/etc/moudles/BM_Sidebar.xml <?xml version="1.0"?> <config> <modules> <BM_Sidebar> <active>true</active> <codePool>local</codePool> </BM_Sidebar> </modules> </config> app/code/local/BM/Sidebar/controllers/IndexController.php class BM_Sidebar_IndexController extends Mage_Core

magento set store id programmatically

大兔子大兔子 提交于 2019-12-03 12:30:27
问题 I am currently working on a magento site that is in 2 languages (French and Dutch). The approach I am taking is as follows: Create a folder in the web root (named nl) Import the index.php and .htaccess file to that folder In the index.php I modify the following line: Mage::run('nl'); // to specify the store view i want to load When I check, the categories, CMS content etc are still in the default language. The following code: Mage::app()->getStore()->getName(); returns the fr store's name.

How to put magento in maintenance

…衆ロ難τιáo~ 提交于 2019-12-03 05:54:57
问题 Is it possible to put a magento site under an maintenance flag so that visitors will get a message that the site is under construction? I can't find this setting in the admin area. Another solution will also be welcome. Any help would be appreciated. Thank you. 回答1: I use this often. http://inchoo.net/ecommerce/magento/maintenance-mode-in-magento/ The important part is: Open: index.php in root and above line 57 add (remembering to edit the ‘allowed’ array to contain the IP’s you want to be

How to get parent product id in magento?

ぃ、小莉子 提交于 2019-12-03 04:38:19
I know that in Magento 1.4.2.0 one gets parent id's like so list( $parentId ) = Mage::getModel('catalog/product_type_configurable') ->getParentIdsByChild( $product->getId() ); My question is: if I don't know what the parent is, how do I know to use the 'catalog/product_type_ configurable ' vs 'catalog/product_type_ grouped ' model to get the id? eric ramahatra You may use: $product->getTypeInstance(); Which will return the type object of your product Then you can perform your: ->getParentIdsByChild() Giving finally: $product->getTypeInstance()->getParentIdsByChild($child->getId()); You can

magento set store id programmatically

萝らか妹 提交于 2019-12-03 02:54:40
I am currently working on a magento site that is in 2 languages (French and Dutch). The approach I am taking is as follows: Create a folder in the web root (named nl) Import the index.php and .htaccess file to that folder In the index.php I modify the following line: Mage::run('nl'); // to specify the store view i want to load When I check, the categories, CMS content etc are still in the default language. The following code: Mage::app()->getStore()->getName(); returns the fr store's name. What is it that I'm doing wrong? I think a viable solution would be to set the store to run in index.php.

Module and ajax call

时光毁灭记忆、已成空白 提交于 2019-12-03 02:47:38
I'm trying to create an ajax call to a custom controller. I've been following: http://www.atwix.com/magento/ajax-requests-in-magento/ - which gives a brief example of how to create. So I have the following files: app/etc/moudles/BM_Sidebar.xml <?xml version="1.0"?> <config> <modules> <BM_Sidebar> <active>true</active> <codePool>local</codePool> </BM_Sidebar> </modules> </config> app/code/local/BM/Sidebar/controllers/IndexController.php class BM_Sidebar_IndexController extends Mage_Core_Controller_Front_Action { public function indexAction() { echo "test data"; } } app/code/local/BM/Sidebar

Add Username to Order Comment History

﹥>﹥吖頭↗ 提交于 2019-12-03 00:46:15
Is there a simple way to add the username of the person who is making the comment in the admin history to the comment thread on the order? -- edit -- Another way of asking this would be how do I add an additional field to the comment history model so that I can override the appropriate models and templates inserting that data into the data structure. Vipul If you want to add the username who is currently logged in and making change in order or commenting on order. you need to add an attribute to magento. Create a Module say Audit app / etc / modules / Namespace_Audit.xml <?xml version="1.0"?>

Programmatically send shipping/tracking mail

早过忘川 提交于 2019-12-03 00:40:17
In Magento 1.4, I am successfully using this code to mark an order as Complete and add a shipping tracking code to it : $order = Mage::getModel('sales/order')->loadByIncrementId($increment_id); if($order->canShip()) { $itemQty = $order->getItemsCollection()->count(); $ship = Mage::getModel('sales/service_order', $order)->prepareShipment($itemQty); $ship = new Mage_Sales_Model_Order_Shipment_Api(); $shipmentId = $ship->create($increment_id); } $shipment_collection = Mage::getResourceModel('sales/order_shipment_collection'); $shipment_collection->addAttributeToFilter('order_id', $order_id);

Magento custom module date field saving date to one day before the selected date

旧街凉风 提交于 2019-12-02 10:52:59
问题 i followed steps on this link to add a date field to my custom module : http://magentomechanic.blogspot.com/2010/01/to-add-custom-date-field-in-custom.html Everything went fine, except for the that when i select a date and save configurations, it returns me date one day before the selected one :( For Example : When i select 25 Feb , 2012 and save , it will save and return 24 Feb , 2012. Notice it saved one day before :( i get this when i print_r($model) in admin controller before save: [start