first i just want to say, you guys are great. without the people in this forum i would have given up on magento ages ago.
ok down to the point.
ive made my own shipping module and it works great. to gives the option of a fixed price or collection. but the problem is you still have to click to get a quote in the cart. how would i make it so the shipping prices are automatically displayed, even better would be if i could have one automatically applied too.
The problem with what you are asking is that the perosn is not necessarily logged in so how do you know where they will want it shipped too? And even if they are logged in they may wish to ship the goods somewhere else.
Lazzymonk, I am trying to do the same thing. I want there to be a default shipping rate then if I ship to different countries then I can overwrite this.
I have been able to do up to now..
- Create a shipping module that does the things I need it too.
- Update the shipping and handling each time a product is added to reflect the correct price
- Automatically add the shipping and handling to the cart without hitting the ‘get a quote’ or ‘updating cart’ buttons
Great ... but when I add something to the cart the first time it does not appear… Just if I either add another one or refresh the cart.
I really need to understand the CartController.
1. What is the difference between the cart and quote objects.
2. When a new item is added to the cart for the first time then what is the sequence of objects. ie is a cart created then converted into a quote or does a quote have a cart in it.
3. Why is the indexAction() called after the addAction() - ie why is the cart init() called after a product is added to it…
4. What is Cart and what is a Quote and are they held seperatly in customer session
I would be interested in seeing how you archived this. i did manage to get the shipping to add automatically but i had the same problem as you with it not working for the first item. At that point i gave up on that route thinking it was the wrong way to do it.
Can someone with knowledge of the cart/quote system help us?
I would like to know the same thing. And I would also like to know how to remove the discount coupon from the checkout page. This store will have no discount coupons, so it’s irrelevant and distracting.
Lazzymonk - did you manage to overload the CartControler or did you use an Event. I have had real problems with overloading. When I enable the overload I find that I get a 404 when ‘Proceed to Checkout” Could you (or someone else) paste in a working CartControler overload Config.xml. I have gone through the Wiki example and it gives the same problem.
Events work fine, just then left with what a Cart / Quote is and how I interact with them. - see previous post.
Any suggestions, however small on this?
Sure - I am very creative and am using the code from the estimatePostAction() and the estimateUpdatePostAction() I put this into the addAction() method. This works after I have added my first product. These lines are added after
$cart->save();
in addAction() :
$country = (string) $this->getRequest()->getParam('country_id'); $postcode = (string) $this->getRequest()->getParam('estimate_postcode'); $city = (string) $this->getRequest()->getParam('estimate_city'); $regionId = (string) $this->getRequest()->getParam('region_id'); $region = (string) $this->getRequest()->getParam('region'); if ( empty($country) ) $country = 'GB'; if ( empty($postcode) ) $postcode = '<PostCode>'; // My Postcode if ( empty($city) ) $city = '<city>'; // My City if ( empty($regionId) ) $regionId = ''; if ( empty($region) ) $region = '';
$code = (string) $this->getRequest()->getParam('estimate_method'); if (!$code) $code = 'tierrate_tierrate'; // My shipping module is called 'tierrate' if (!empty($code)) { $this->getQuote()->getShippingAddress()->setShippingMethod($code)->save(); }
ive tested your code. but without any of the config.xml changes and it seems to work great. the shipping is being added as soon as the first item is added, and updated as soon as something new is added. but at the moment im only using fixed rate per item shipping.
maybe the problem is with your shipping module. But from what i have found is that they either work or dont, there is no sort of work with them.
Ok update - I have just checked using flat rate and updating the $code line to ‘flatrate_flatrate’ and the sequence is ...
Clear sessions from var/sessions directory
Go to Catalog page
Click ‘Add to cart’
Shopping cart empty...sob sob
Click ‘continue shopping’ and go to Catalog page again
Click ‘Add to cart’
Product appears in cart with correctly calculated S&H;(P&P;) - yer woohoo
Good news though : I have figured out why there seems to be two passes of the CartController The first one is to add the product - addAction() - then once that is complete there is a redirect to the Cart screen so this time it goes through the indexAction()