Showing posts with label Magento. Show all posts
Showing posts with label Magento. Show all posts

Monday, May 20, 2013

Published 2:17 AM by with 0 comment

Unable to fetch all items of an order in Magento?

I used this in my module. it may help you.

Load Magneto Order and Product Collection

$resource_model = Mage::getResourceModel('sales/order_collection');
$product_model = Mage::getModel('catalog/product');

Loop through order collection

$records = 0;
    $productData = array();
    $orderProductArr = array();

    foreach($resource_model as $all_orders)
    { 
        if($all_orders['status']!="canceled" && $all_orders['status']!="fraud")
        {  
            $i = 0;
            $items = $all_orders->getAllVisibleItems();

            foreach($items as $item)
            {
                $_product = $product_model->load($item->getProductId()); // getting product details here to get description

                $taxClassId = $_product->getData("tax_class_id");
                $taxClass = $_product->getData("tax_class_name");

                $taxRate = $order['tax_amount'];

                $orderProductArr[$i]['web_id'] = $item->getProductId();
                $orderProductArr[$i]['quantity'] = $item->getQtyToInvoice();
                $orderProductArr[$i]['price'] = $item->getPrice();
                $orderProductArr[$i]['description'] = $_product->getDescription();
                $orderProductArr[$i]['currency'] = $order['order_currency_code'];
                $orderProductArr[$i]['tax_id'] = $taxClassId;
                $orderProductArr[$i]['tax_amt'] = $taxRate;
                $orderProductArr[$i]['total_amt'] = ($item->getPrice()*$item->getQtyToInvoice())+($taxRate);

                $productData[$i]['title'] = $item->getName();
                $productData[$i]['web_product_id'] = $item->getProductId();
                $productData[$i]['price'] = $item->getPrice();
                $productData[$i]['product_sku'] = $item->getSku();
                $productData[$i]['tax_class'] = $taxClassId;
                $productData[$i]['description'] = $_product->getDescription();

                $tax_arr[$i]['tax_id'] = $taxClassId;
                $tax_arr[$i]['tax_class'] = $taxClassId;
                $tax_arr[$i]['tax_amt'] = $taxRate;

                $i++;
                unset($items);
            }   
            $data[$records]['order_data']['product_details'] = $orderProductArr;
            $data[$records]['order_data']['order_product_details'] = $productData;
            $data[$records]['order_data']['tax_arr'] = $tax_arr;
            unset($orderProductArr);
            unset($productData);
            unset($tax_arr);
            $records++;
        }   
    }
Read More
    email this       edit

Tuesday, May 14, 2013

Published 9:21 PM by with 0 comment

I changed the {{base url}} in the config and I can not revert it back



I have faced a problem changing {{base url}} through the magento admin portal and I can’t change it back. I can’t connect to admin area either. 

I found a solution and it can be change in DB. 





UPDATE core_config_data
SET value = '
correct URL here'
WHERE config_id = 7




Read More
    email this       edit

Monday, May 13, 2013

Published 9:47 PM by with 0 comment

Magento: The requested URL /Index/index.php was not found on this server.










Magento: The requested URL /Index/index.php was not found on this server.


Solution is modifying the .htaccess file.
------
Order deny,allow
Deny from all

RewriteEngine on
RewriteRule !\.(js|ico|gif|jpg|png|css|php)$ index.php
php_flag magic_quotes_gpc off
php_flag register_globals off
Read More
    email this       edit