News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

assign specific payment or shipment method to specific product

Started by normangreen, May 13, 2015, 05:26:45 AM

Previous topic - Next topic

normangreen

hello

If I have three products named product-A, product-B, product-C and two payment methods named payment-I, payment-II and two shipment methods named shipment-1,shipment-2.

Then I want the product-C can only use the payment-II and shipmet-2, there is no other payment and shipment method(payment-I and shipment-1) for customers who buy product-C to choose.

My objective is to let the specific product in the checkout process can only use the specific payment or shipment method for coustomers.

How can I configure to achieve the objective?

Thank you.

rinopiponte

I had the very same problem in my shop, because I combine several kinds of products at http://design-it.es.

This is a trick, but you have to be very careful because it implies changing the code of virtuemart core

* For shipment its easy if you set different ranges of shipment depending on weight, for example Product A with shipment A only if PA weights less than 100Kg, PB with SB if it weights less than 50Kg and PC if it weight less that 25Kg. If you can set these conditions without impacting on other areas you have it solved. You have to change shipment plugin

* For payment you will have to change the code at /components/com_virtuemart/views/cart/tmpl/select_payment.php
For each product at line 26 you'll have to write

You have to set a tick for example if it is a category:

foreach ($this->cart->products as $pkey => $prow) {
if ( $prow->virtuemart_category_id == 'XXX'){
$TICK = 1;
}
}


or for a single product


foreach ($this->cart->products as $pkey => $prow) {
if ( $prow->product_name "Or $prow->url or whatever"== 'XXX'){
$TICK = 1;
}
}


Then depending on your shipment order, you'll have to select for each tick only the shipment method you want to display.

Do this only if you can code using php, and of course backup the modified files before changing a single character.

Hope this helps
**************************
VM Plugin Developements: http://design-it.es/diseno-web-extensiones
Website: http://design-it.es
**************************

reinhold

Regarding shipping: With my Advanced Shipping by Rules plugin (http://open-tools.net/virtuemart/advanced-shipping-by-rules.html) it is realy easy to hide a shipping method if a particular product is in the cart.

You can make your shipping method unavailable for a product by prepending this rule to the method's rules for shipment-1:

Comment="No shipment-1 for product C"; contains_any(SKUs, "product-C"); NoShipping
...[here come your other rules for the shipping method]...

This will simply not offer the method if product C is in the cart. If product C is not in the cart, the method might offer shipping if the next rules match.

Regarding payment, I have no idea how you can easily implement this without modifying the VM code itself.

Best regards,
Reinhold

Dragoner

Hi, is this funcional in vm3?

foreach ($this->cart->products as $pkey => $prow) {
if ( $prow->virtuemart_category_id == 'XXX'){
$TICK = 1;
}
}


Pls can you send me your file select_payment.php

Thank you
David


Dragoner

Shipment rule is nice, but i need only payment rules.

Somethink like this ... I have two products

Product 1 and product 2
Product 1 ... payment only by credit card
product 2 ... payment by credit cart and cash

If i get to cart product 1 and product to, payment must be only credit card ...
Is it possible?


Sorry for my english :)
Thanks David

Studio 42

You can use categories as filter in the shipment methods.
Check if the plugin developer can add this restrictions in your payment methods, so you can use categories to restrict the displayed methods.