Shipping Methods are not working in magento 1.7 - magento

I activated flat shipping in the shipping options and whenever you do checkout it says “Sorry, no quotes are available for this order at this time.”Any one please help me since i am a beginner in magento.
EDIT
I have tried other shipping methods too its also showing the same. we have upgraded Magento ver. 1.4.1.1 to magento 1.7. Any help would be greatly appreciated..
EDIT 2
After upgrading community folder contains only Phoenix folder. After that i added Biebersdorffolder by seeing an error in checkout page. I don't the the purpose of folders AW and RocketWeb. Since i am not familiar with magento.
If the image is not visible i have added the image in this url
http://i47.tinypic.com/14smix1.jpg

do you have any Checkout files modified on your project? Or maybe custom checkout.
I will list the code locations you need to check to make sure your Shipping works correctly.
So to begin with: Magento has very special work process with Shipping rates - it's called "collectRates" and is some modification of pattern "composite".
To make sure that everything works correctly on the code basis you need to first check the Onepage.php model (app/code/core/Mage/Checkout/Model/Type/Onepage.php): lines 330, 341, 556, 616; There should be code
{address}->setCollectShippingRates(true)
where {address} is current address variable.
This code is significant for future "collectRates" processes, because just when the Onepage Checkout page is initializing the "collectRates" process has already been processed, and the flag "collect_shipping_rates" is set to "false". If it's not set back to true, the next "collectRates" process will not be performed.
After you check the location above, and it still doesn't work - you might want to add some logging to Mage_Checkout_Block_Onepage_Shipping_Method_Available::getShippingRates method. If method is properly executed and return some rates from $this->getAddress()->getGroupedAllShippingRates() call, there might be some issues with .phtml template on your locan theme (default path to .phtml is app/design/frontend/base/default/template/checkout/onepage/shipping_method/available.phtml).
Here's how you can log the outcome from $this->getAddress()->getGroupedAllShippingRates() call (Mage_Checkout_Block_Onepage_Shipping_Method_Available::getShippingRates method):
$groups = $this->getAddress()->getGroupedAllShippingRates();
$printGroupes = array();
foreach ($groups as $code => $groupItems) {
foreach ($groupItems as $item) {
$printGroupes[$code][] = $item->getData();
}
}
Mage::log($printGroupes, null,'special.log');
Please note, that the result array with all rates will be logged into "special.log" under var/logs folder.
I wish I could be more of help, but the issue requires some digging into code, the debugger will be even more helpful than logging, if you can get hold of one.
Cheers!

Price should be entered for Flat Rate shipping to work
The problem might be of the country selection
Ship to applicable countries is set to "Specific Country" and you selected "Canada".
So you will see this shipping method only if you select Canada on the frontend during the checkout.
Or
You can make this to All Countries and check whether its working or not.

Related

What could cause Magento to change new address back to default address on Paypal redirect?

I'm getting a strange bug in Onepage checkout using Paypal Express.
Logged-in Customer enters new billing address "on-the-fly", sets 'Save in Addressbook' and 'Ship to this address', then proceeds through checkout.
Address is saved in the database correctly at this point.
Customer chooses Paypal and Magento goes through it's logic (collection totals, saving quote - twice and data checks, etc).
I've stepped through the logic using Xdebug and am not able to pinpoint exactly where but right before redirecting to Paypal in /app/code/core/Mage/Sales/Model/Quote.php on line 318 in afterSave() callback, there's a line
if (null !== $this->_addresses) {
$this->getAddressesCollection()->save();
}
In $this->getAddressesCollection(), the billing and shipping addresses are wrong, they're both the Customer's default. However, the database is still correct.
Once the ->save() fires, the correct ones are overwritten.
It certainly appears to be Magento bug but I need to find a solution. This is EE 1.11.1.0.
Anyone experienced this before?
Thanks
I had a similar bug and maybe its the same with you. If you select an address as your default address in the address book it screws up the one page checkout.
Say I have 3 people in my address book: John, Suzy and Bill.
One day I happen to be in my address book and I select John as my default billing and shipping address. Then I go to my cart, order some items, select John as billing, and select ship to a different address. On the next step I select Suzy as my ship to address. I click next to go to the shipping method step, but whoa, wait! Suzy's address has been overwritten and replaced with Johns address.
Its exactly the same issue posted about here (although I dont think the guy understands what happened, but the screenshots are the same result): http://www.magentocommerce.com/boards/viewthread/7520/P0/
The issue is in the opcheckout.js file. I have a fix. basically once a default address is selected the add new address form (hidden form) is always populated with your default address.
Normally, without a default address selected in address book, I believe that the opcheckout.js properly fills in the hidden fields with the address you selected in the select box.
The following modified opcheckout.js script: ( http://pastebin.com/chiwyRJZ ) will fix it so that the hidden fields are properly filled with the correct data. From what I understand is this is an old unfixed bug, perhaps from whichever version Magento added the Add New Address form in one page checkout
To apply the fix, copy the code from paste bin and replace it with the code in your themes opcheckout.js
Usually opcheckout.js is in skin\frontend\default\yourtheme\js
OR
\skin\frontend\base\default\js
I know it is too late to post this, but I faced this issue on Magento 1.9.x. not only on paypal, but all other payment methods.
Check this method witch called upon creating new Quote:
public function assignCustomerWithAddressChange

Magento: how to get the price of a product with catalog rules applied

I'm developing a script (external to Magento, not a module) which aims to output a text list of all available products, their prices and some other attributes. However, catalog price rules don't seem to be applied to product prices. If I use any of the following:
$_product->getPrice()
$_product->getFinalPrice()
I get the normal price (without rules being applied).
If I use:
$_product->getSpecialPrice()
I get null unless the product actually has a special price inserted in the product itself (i.e. if special price is not related with catalog rules).
I also tried
Mage::getModel('catalogrule/rule')->calcProductPriceRule($product,$product->getPrice())
as suggested in the answer given by Fabian Blechschmidt, but interestingly it returns the normal price only if the product is affected by any catalog rule, returning null otherwise.
There was a similar question in StackOverflow and Magento Forums some time ago, but the provided answer (which is to insert the code bellow) doesn't work for me (returned prices remain the same).
Mage::app()->loadAreaPart(Mage_Core_Model_App_Area::AREA_FRONTEND,Mage_Core_Model_App_Area::PART_EVENTS);
Does anybody have an idea of how to achieve this?
I'm using Magento 1.6.2.0.
Thanks in advance.
Thanks to you, I found a new site:
http://www.catgento.com/magento-useful-functions-cheatsheet/
And they mentioned:
Mage::getModel('catalogrule/rule')->calcProductPriceRule($product,$product->getPrice())
HTH
As catalog price rules heavily depend on time, store and visiting customer, you need to set those parameters when you want to retrieve the product final price with it's price rules applied.
So, in your case, make sure that provided product is passed with the desired store and customer group id, which can be set as:
Mage::getModel('catalogrule/rule')->calcProductPriceRule($product->setStoreId('STORE_ID')->setCustomerGroupId('CUSTOMER_GROUP_ID'),$product->getPrice())
I discovered the problem. The discounted prices display Ok in the store frontend. The problem was that I was developing a script "external" to Magento (thus not a Magento module), something like:
<?php
set_time_limit(0);
ignore_user_abort();
error_reporting(E_ALL^E_NOTICE);
header("Content-Type: text/plain; charset=utf-8");
require_once "app/Mage.php";
// Get default store code
$default_store = Mage::app()->getStore();
...
For everything to work properly it seems that one must follow the proper Magento bootstrap, and develop everything as a module. My script was so simple that I thought it wouldn't be necessary to code a complete module. In other words, everything in Magento should really be a module.
Concluding, using the module approach, all the methods work as expected:
$_product->getPrice()
$_product->getFinalPrice()
$_product->getSpecialPrice()
Thank you all for your input.
This helped me in this issue: http://www.magentocommerce.com/boards/viewthread/176883/
. Jernej's solution seems plausible, but it does not handle rules that Overwrite other rules by using 'stop processing' and therefore can apply more than one rule.
$original_price = $_product->getPrice();
$store_id = 1; // Use the default store
$discounted_price = Mage::getResourceModel('catalogrule/rule')->getRulePrice(
Mage::app()->getLocale()->storeTimeStamp($store_id),
Mage::app()->getStore($store_id)->getWebsiteId(),
Mage::getSingleton('customer/session')->getCustomerGroupId(),
$_product->getId());
// if the product isn't discounted then default back to the original price
if ($discounted_price===false) {
$discounted_price=$original_price;
}

Magento. How to change shipping method before save order?

I must change shipping method before saving order if (condition) is true, and don't change it if false. I tried out function checkout_type_onepage_save_order($observer).
$checkout = Mage::getSingleton('checkout/type_onepage');
$checkout->saveShippingMethod('freeshipping_freeshipping');
but it doesn't work.
Sorry for my English.
Thanks.
I have had problems with things not saving properly in checkout, e.g. shipping address. I think you have to save the quote object again, but I cannot remember for sure.
However, why don't you write your own shipping module? This is the place for doing it properly and within your own module you can put together all the rules you need to set the price to what it needs to be, plus the frontend label, e.g. 'Free!' if a zero price is calculated.
Here is a tutorial that has worked very well for me in the past:
http://www.excellencemagentoblog.com/magento-create-custom-shipping-method

Virtuemart Coupon Plugin based on quantity not value

I've had a look at available Virtuemart plugins and I can't find anything close to what I am after. This is what I need.
Allow admin user to create coupon codes. An import feature would be nice as there will be thousands but I can handle this bit if needed anyway.
The admin user selects the number of products the customer is allowed for each coupon code.
When the customer uses the coupon code they are allowed to choose any product on the website up to the total amount of products issued to the coupon. Regardless of the products price.
Nice extra would be to allow free shipping with the coupon.
I've looked at the possibility of extending virtuemart and I think it would be possible. It would however require quite a lot of changes and if I can find something that is halfway there it would help me on my way.
Thanks in advance.
OK well time was running out and I didn't get an answer so I rolled my own. It was actually fairly painless. I can't release the code but I can give you a good idea of the steps and a direction to go in.
extend vm_ps_coupon and override the update, add and process methods. Add and update should only require a change to the array that is sent to the DB. See here for more info on extending classes
Alter the enum in the database to allow for quantity as well as total and percent.
Within your new update method handle the variation of quantity to do as you need.
In the update method you can also set a flag for free shipping in a session variable.
In templates/checkout edit list_shipping_methods.php. Simply check for the free shipping flag and load the free_shipping class. You can then call free_shipping->list_rates($vars);
extend vm_ps_checkout, override the add method, call the parent add method and then check the result so you can delete the session variable for the free shipping.
Finally you will need to make some changes in the HTML. Unfortunatly i could not find a way to override this easily and since its only two small changes to the markup i just went ahead and hacked the core. If anyone knows of another way that would be great? I did see something online about using a Joomla hook and a System plugin but I'd rather keep it reliant on Virtuemart only.
In administrator/components/com_virtuemart/html/ edit coupon.coupon_form.php to show the new quantity radio button.
Then edit coupon.coupon_list.php to display the correct values. Currently it will only display percent and total.
Hope this helps someone in the future. If you need some assistance then post on here and I'll be happy to help.

Magento - How to make new shipping address (additional) as default

I developed a custom checkout module and is working fine. During checkout for the first when I enter new billing and shipping address, they are getting set as default billing and shipping address, which is fine. Now, I have a requirement, whenever a new shipping address is entered, this should become as default shipping address. Somehow, I cannot make this work. I have tried the following:
$shipdata is a array having the new address details.
$shipAddress = $this->getQuote()->getShippingAddress();
$shipAddress->addData($shipdata);
$shipAddress->setIsDefaultShipping(true);
if($this->getQuote()->getDefaultShipping()) {
$this->getQuote()->setData('default_shipping', '');
$this->getQuote()->addAddress($shipAddress);
}
$this->getQuote()->collectTotals();
$this->getQuote()->save();
I also tried to add the following in the $shipdata
$shipdata['default_shipping'] = 1;
but also did not help.
Can some one help in this regard?
You could try to use an observer on the "customer_address_save_before" event. Setting the isDefaultShipping flag there will work. Only thing I don't know is checking whether you are in the checkout process.
In the form that posts to the next page simply include a hidden input

Resources