Magento Payment methods depending on fields Company and VAT ID - magento

We would like Magento to only display the payment method "Purchase order" when the fields "Company name" and "Taxvat" are filled out on the Magento checkout page. (so that only businesses can purchase and pay afterwards)
We use Firecheckout, but that doesn't matter because it requests the payment methods every time something changes in the address (like company name).
So the modification has to be made somewhere in the function $methods = $this->getMethods(). But where and how to do it? I know that the payment methods can by default be dependend on the country entered on the same page, so it should be possible that it's also dependend on the Company and VAT fields.
Thanks for your help guys!

Related

How to validate shipping address per product by city and restrict user?

I am using Magento 1.9. I want to create product and make available in only specific cities. And also I want to restrict users on checkout when they select product to ship in the city where the product is not available.
I am a beginner at Magento and don't know how to achieve this.
What I have in mind so far is, it will be good to create an attribute named 'city', make it multiselect and add cities as it's options. So now I can create product and assign multiple cities to it. and can be seen at the 'Additional Information tab' on frontend product's page.
But now I want to restrict user if he select orders product available in "New York" and he submitted shipping address with any other city. This should restrict the further process and display message.
In short, I want to restrict user on checkout and display message. "The product is not available in the specified address/city/location etc"

Shipping Amount for different payment method in magento

how to apply different shipping amount for each payment method in magento? Now i am currently using two payment methods.
1) credit cart
2) Cash on delivery.
When customer selecting credit cart payment method shipping price is free.
and when customer selecting Cash on delivery payment method shipping price is 100.
FYI : my default shipping amount is 100.
Can anyone explain me briefly?
Thank
Prakash.
The problem is that the payment method is chosen based on the shipping method, so you can't change the shipping after choosing a payment method.
One possibility is to offer to different shipping method which restrict the payment methods after selecting.
I've created a magento module which does this, feel free to take a look on the sourcecode how it restricts payment methods based on shipping rates. This is the way I'd go.
https://github.com/thebod/Thebod_Shippingrates
You can create a Promotion rule with the Shopping Cart Price Rule for specific Payment Methods.

Remove Tax at Checkout for B2B customers in Magento

I need to dynamicaly remove tax during checkout for business to business customers in Magento. I have a module which asks for a VAT ID during checkout and checks it against the European Online VAT-ID Validation Service. If the VAT ID is valid, the tax should be removed during checkout.
The module already assigns new customers with valid VAT ID to the according business to business group in Magento. Customers who order for the first time and create their account during that first checkout, get charged VAT (even with valid VAT-ID).
I basically need to know, how this can be done, which methods involved, etc.
I've got a similar setup going on at the moment, what I have done is if the VAT# at checkout is stored in mage_checkout_model_session. The call
Mage::getSingleton('checkout/session')->getQuote()->getCustomerTaxvat()
In my instance is returning the VAT number for me to check elsewhere. Your VAT# validator is certainly setting something similar to this. At this point you can either create a new module to modify the tax, or override the controller with
$x = Mage::getSingleton('where_your_extension/stores_the_value)->getIsVatValid();
if ($x) $this->setTaxValue( 0 );
else //magento sets it automatically
and it will set the tax rate to zero for the remainder of the session. It will work with guests and registered customers.

Programmatically apply a discount price in product list

I would like to programmatically display a discounted price on the product list/page so that each customer as a personal price shown based on a customer attribute (like gender for instance, and of course let it be assigned as new price for the user session) but I can't see a viable option via the magento catalog price rules involving customer attributes other than the assigned group.
I'm using the group to do different kind of discounts and categorization of the customers, so the path of "split the customers on the gender" (or similar) is not an option unfortunately, since I can't assign more than 1 group per customer.
At the moment I was thinking about setting up a custom observer to check for calls to the price generation and then let it consider my customer attributes when calculating the price.
Is that possible? if so, any pointers about?
Would you suggest something different?
Thanks a lot to everyone for your time.
As I was thinking before, I solved my issue creating a custom module with an observer looking for catalog_product_get_final_price calls, getting the customer details from the current customer session.
It works great, I just need to let it display the correct price in the catalog product list, but is minimal, as the price seems to be calculated correctly inside the product page and the cart

how to get id of product in shipping method

Is there anyway to get product Id of product in Shipping module, so that for different category I can charge Additional amount.
for eg: i have to two product in carts. One is in phone category and other is in computer category. for shipment I have to add $5 for phone and $25 for computer . so shipment charge should be $30 dollars in frontend. Is there anyway I can get product Id and corresponding product's category Id in Shipping method collect rates method??
Please help me, I am in a deep trouble....I hope Eg that I provided , explains what I need.
Thanks in advance.
You can get the products from quote
Mage::getSingleton('checkout/cart')->getQuote()->getAllItems();
or
Mage::getSingleton('checkout/type_onepage')->getQuote()->getAllItems();
and iterating over those items (be aware of grouped and bundled parents and so on) will give you the category(s) they might belong to and you can make your conditions against those
This is only a tenable option if products belong to only one category. Unless something has changed in the last couple of versions, there is no data for quote items that shows the category context from which they were added.
WebShopApps.com has several already-developed solutions for shipping scenarios. Depending on development contract & budget, it may be more cost-effective to use one of their well-tested extensions, e.g. Shipping Override Matrix.

Resources