Restrict countries for shipping in magento - magento

I have multi store website in magento. In one of my website I want to restrict the countries that I can make shipping. But the payment can be received from anywhere of the world. I have tried
system --> configuration --> web --> general
And
system --> configuration --> shipping method --> specify country
but the problem is that in checkout page, I want to show all countries name in the dropdown list of billing information and I want to show only a specific country, eg: India in the dropdown list of shipping information. Is there any way to do so? Any help would be great full... Thank you.

From Class : abstract class
Mage_Checkout_Block_Onepage_Abstract
public function getCountryHtmlSelect($type)
$select = $this->getLayout()->createBlock('core/html_select')
->setName($type.'[country_id]')
->setId($type.':country_id')
->setTitle(Mage::helper('checkout')->__('Country'))
->setClass('validate-select')
->setValue($countryId)
->setOptions($this->getCountryOptions());
So setOptions($this->getCountryOptions() is responsible for that drop down list of shipping countries.
Here you place is $type is equal to shipping then call $this->getShippingCountryOptions()
follow this by writing your own code for this function refering to function getCountryOptions() code.
Note : Do not touch core files. This is just a guideline.

Related

magento product specific zip code checking

I am using magento 1.8.1
I am using zip code Check Delivery Details, like to check if delivery service is available at the client area or not and this is general.
this is working fine.
But now I want to do this product specific like some product are avaialble to some are with different delivery details for eg, xxx product is available to 111111 zip code in 6 days, to 222222 zip code in 2 days , 33333 delivery not available etc.
I want such product specific delivery detail checking.
Can anyone help me to know if such extension is available or not.
or any specific coding for this.
You need to create your own shipping module to inform whether the product is available for delivery or not.
Check How to create custom shipping module http://excellencemagentoblog.com/magento-create-custom-shipping-method
Then in function
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
{
//check your product shipping availability based on your conditions.
// set all the shipping parameter if product shipping is available.
// or set error message to display user
}
for any queries reply back.
Thank you

Get Customer Address Details on Magento Backend

for my magento backend I need a link which is consiting of different customer informations.
So I want to get the specific Inforamions out of the backend but I don't know how.
I've already looked into the adminhtml/.../template/sales/order/view/info.phtml
and found the following line:
<?php echo $this->htmlEscape($_order->getCustomerName()) ?>
This is fine, but I need diffenent variables for Customer Name, - Street, -Postcode, City to
build up a link like that:
www.domain.de/category&name=CustomerName&Street=CustomerStreet& ....
How can I get these variables?
Thanks a lot for every answer!!
Customers can theoretically have many addresses. If you need the one supplied as the billing address with the order, use
$address = $order->getBillingAddress()
This will return an object of the Mage_Sales_Model_Order_Address type, whose properties you can access via
$address->getCity()
$address->getStreet()
etc.
Otherwise you can fetch the customer's default billing address by calling
$address = $order->getCustomer()->getPrimaryBillingAddress()
You can access to the entire customer address collection as well:
$customerAddresses = $customer->getAddressesCollection()

Magento Core API: listing all shipping methods

The cart_shipping.list method in the Magento Core API does not return all shipping/payment methods enabled on the admin site. The enabled methods are Flat Rate, Table Rates, Free Shipping, UPS, USPS, FedEx and DHL. Calling cart_shipping.list only returns Flat Rate, Free Shipping and UPS.
Any ideas as to why?
My main suspicion (when looking at the getShippingRatesCollection() function of the Mage_Sales_Model_Quote_Address class) is that the shipping address set for the order is used to filter some of the methods out. However, I don't fully understand how this filtering occurs, since in the front end this problem does not occur when using the same shipping address (i.e. I can see all the shipping methods that I expect to see for that address).
I have found a working solution to this issue, at least in my case.
The problem was that I was not specifying a Store Id in any of the methods used to create a cart and specify its products and delivery/billing addresses leading up to the call to cart_shipping.list.
These methods are: cart.create, cart_customer.set, cart_customer.addresses and cart_product.add. They all take a Store Id as an optional parameter. Specifying this store ID leads to all shipping methods visible in the front end for the same product and delivery address being displayed.

How to prevent ordering certain products - or a category - from a specific country

I have a category dedicated for exported goods , obviously , they will not be sold locally . so , how can I prevent customers who are from my country from ordering products that are meant only for exporting.. and showing an error message .. please help !
I would say that you will have to create a new product type. You'll need a new module (use Daniel's excellent kick-start extension: http://www.magentocommerce.com/magento-connect/Daniel+Nitz/extension/1108/modulecreator) and then have your model extend Mage_Catalog_Model_Product_Type_Simple.
Then, add a new attribute for your new product type to capture Allowed Countries, and implement the isSalable method in your Model to check for Allowed Countries.
This is not trivial, but it should be the right approach. The guys at Inchoo (who write a great blog) have a good tutorial on the process: link text and in fact they've provided the shell of the module.
Good luck!
JD

Magento : Converting currency before sending data to Google Checkout

I have a magento site with base currency in USD and Google Checkout in GBP.
Google Checkout: The currency used in
the cart must match the currency of
the seller account. You supplied a
cart with USD and the seller account
is associated with GBP.
Is there a way in magento to convert the amount to GBP before sending to Google Checkout ?
i guess a module could be written to achieve this, but any other workaround ?
Okay, this is far too late, but I hope someone will find this useful.
I don't know how your system works and which version of Magento you are using, but in 1.5 (the one that I am using) in the module GoogleCheckout, look for Model/Api/Xml/Abstract.php, this is base Model for the others models in the GoogleCheckout XML API and it has a method called getCurrency();
public function getCurrency()
{
if (!$this->hasData('currency')) {
$this->setData('currency', Mage::app()->getStore()->getBaseCurrencyCode());
//$this->setData('currency', $this->getLocale()=='en_US' ? 'USD' : 'GBP');
}
return $this->getData('currency');
}
Since it is not good idea to override Abstract class in PHP according to this you will need to copy this class to the local folder and change the method getCurrency() so it transforms the currency to GBP.

Resources