Virtuemart || E Commerce (6)
Virtuemart "PayPal (new API)" is causing "Credit Card" payment option to appear for no reason.
Written by AdministratorThis has been copied from www.aglobalweb.com so I can refer back to myself in future.
Problem
The introduction of new payment method "PayPal (new API)" is causing "Credit Card" payment option to appear for no reason.
Solution
To completely get rid of this problem, there are 3 files involved
- administrator/components/com_virtuemart/classes/ps_checkout.php -> method list_payment_methods()
- administrator/components/com_virtuemart/classes/ps_payment_method.php -> method list_payment_radio()
- components/com_virtuemart/themes/default/templates/checkout/get_payment_method_paypal_ex.tpl.php
administrator/components/com_virtuemart/classes/ps_checkout.php around line 830
Paypal (new API) are implemented separately from generic Virtuemart payment methods. So we need to prevent it from reloading again
function list_payment_methods( $payment_method_id=0 ) {
...
$db_nocc = new ps_DB;
$q = "SELECT * from #__{vm}_payment_method,#__{vm}_shopper_group WHERE ";
$q .= "#__{vm}_payment_method.shopper_group_id=#__{vm}_shopper_group.shopper_group_id ";
$q .= "AND (#__{vm}_payment_method.shopper_group_id='".$auth['shopper_group_id']."' ";
$q .= "OR #__{vm}_shopper_group.default='1') ";
$q .= "AND (enable_processor='B' OR enable_processor='N' OR enable_processor='P' AND `payment_class`!='ps_paypal_api') ";
$q .= "AND payment_enabled='Y' ";
$q .= "AND #__{vm}_payment_method.vendor_id='$ps_vendor_id' ";
$q .= " ORDER BY list_order";
...
}
administrator/components/com_virtuemart/classes/ps_payment_method.php Line 394-397
Paypal (new API) are implemented separately from generic Virtuemart payment methods. So we need to prevent it from reloading again
function list_payment_radio($selector, $payment_method_id, $horiz) {
...
$q = "SELECT payment_method_id,payment_method_discount, payment_method_discount_is_percent, payment_method_name from #__{vm}_payment_method WHERE ";
$q .= "(enable_processor='$selector' AND `payment_class`!='ps_paypal_api') AND ";
$q .= "payment_enabled='Y' AND ";
$q .= "vendor_id='$ps_vendor_id' AND ";
...
}
components/com_virtuemart/themes/default/templates/checkout/get_payment_method_paypal_ex.tpl.php Line 74-86
If you only use one payment method "Paypal (new API)", you need that payment method to be selected by default.
<fieldset><legend><strong>PayPal</strong></legend><table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td style="vertical-align:middle;">
<input type="hidden" id="paypalExpress_ecm" name="payment_method_ppex" value="" />
<input type="radio" id="paypalExpressID_ecm" name="payment_method_id" value="<?php echo ps_paypal_api::getPaymentMethodId();?>" checked="true" />
</td>
<td>
<?php echo $html; ?>
</td>
</tr>
</table>
</fieldset>
- In this tutorial we will be adding a new product to our shopping cart. This assumes you have already logged into your website and are at the Virtuemart Administrator page
- Navigate to Products >> Add Product
- Enter a SKU
- Enter a name for the product
- Select a category for your product - For multiple catagories hold down ctrl (PC) or cmd (mac)
- Enter a price for your product
- If you have a tax value, the total including tax will be calculated for you
- You can enter a discounted price if you like
- Enter a short description for your product. This will be displayed when people are viewing the category your product is in
- Enter a description for your product. This will be displayed when people are viewing the product
- Let's move on to the Product Status tab
- Enter the number of this item you have in stock
- Enter the availability on the product. This can be anything you want
- If you have any attributes for the product, list them here
- If you have any custom attributes add those here. This would be useful for an engraved message or name
- Let's move on to Product Dimensions and Weight
- Enter the information for your product
- If you have a downloadable product you can set that information here
- Let's move on to the Product Images tab
- Browse to upload your image
- VirtueMart can auto-create a thumbnail for you. Or you can upload one yourself
- Let's move on to the Related Products tab
- You can set other products to be shown on the product page. This is a great way to upsell visitors to your site
- Save the product
- Let's go check what the product looks like on the frontend
- This tutorial assumes you are logged into your website and at the Virtuemart Admin screen either by the backend or frontend of your website
- Navigate to Manufacturer >> Add Manufacturer Category
- Enter a name and description for the category
- Save the category
- Your new category has been created
Next to add the Manufacturer;
- Navigate to Manufacturer >> Add Manufacturer
- Enter the manufacturers name
- Enter their website - if required, though this could drive users away from your site to the manufacturers website
- You can select a category for them
- And enter an email address for them - if required, though this could drive users away from your site by emailing the manufacturer direct
- Save the manufacturer
- Your new manufacturer has been created
- Firstly we are assuming you are logged in to the admin panel of Virtuemart either by the front end or back end of your website.
- Navigate to Coupon >> New Coupon.
- Enter the coupon code. This can be anything you want - christmas10% , dDgu&6hk, 5poundoff, etc.
- You can choose if it's for a percentage off the order or an amount off the order.
- You can choose the type of coupon as well. A Gift Coupon can only be used once. A Permanent Coupon has no limits. if using a permanent coupon you need to remember to return to the coupon page and disable it when you no longer need it.
- Enter the value of the coupon.
- Save the coupon.
- The coupon has now been created & be used during the checkout procedure.
Changing "Please Select a Shipping Method" text in Virtuemart
Written by AdministratorI recently needed a simple way to inform users in countries that shipping is not set up as standard, to contact us for shipping costs. The standard message if there is no shipping set up is "Please Select a Shipping Method", which i s a bit annoying if there isn't one showing up and the user will go elsewhere.
Here's my simple solution to alter that text;
- Go to /administrator/components/com_virtuemart/languages/common/english.php
- download english.php and open in a text editor/ BBE/Dreamweaver
- Line: 293 'PHPSHOP_CHECKOUT_ERR_NO_SHIP'.
- Change the standard text "Please select a Shipping Method" to "whatever you want"
- Save your file - with exact same name
- Upload by FTP
- Clear joomla site cache
- Check in front end
After line 16 in addtocart_form.tpl.php (browse template, includes folder) add:
<?php echo $ps_product_attribute->list_advanced_attribute($product_id);?><br />
This shows the combobox for your simple attributes (for example: a color picker)
Around line 410 in shop.browse.php (administrator component, html folder) comment/remove the following bit:
&& !ps_product::product_has_attributes( $db_browse->f('product_id'), true )
leave the rest of the if statement alivethis shows the add to cart button, that is normally hidden when you have simple attributes set up.