Administrator
Virtuemart "PayPal (new API)" is causing "Credit Card" payment option to appear for no reason.
This 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>
Move Joomla User from one site to another
I recently needed to copy users from one joomla site and insert those into another working site in preparation to move a forum. The majority of my users where already synk'd between the 2 sites as i was using Discouri's Synk, but the user ID's were different and this is where my problems lay.
I initially thought that All that would need to be done is to copy the jos_users from Site A and Import them into Site B. It wasnt.
This guide will show you what tables you need to backup to transfer users between two Joomla! sites and assumes that you want to wipe out the users on your target site and replace them completely with the users from the other site. I don't and can't guarantee anything here, so always have everything backed up and test on a test server first. I have followed these instructions and it worked for my particular scenario.
The first step in this process is to back everything up, I would use Akeeba pro to back up both sites & DB's then in PHPmyAdmin back up the tables were going to be messing with and store them somewhere safe.
First select your database and then select the 'export' option.
This will give you a list of tables that are stored in your Joomla! database.
If you're using the default prefix, the names of the tables you want to export are:
- jos_users
- jos_core_acl_aro
- jos_core_acl_groups_aro_map
- jos_core_acl_groups
TRUNCATE TABLE `jos_users`;
TRUNCATE TABLE `jos_core_acl_aro`;
TRUNCATE TABLE `jos_core_acl_groups`;
Again here I personally went into each table individually instead of emptying them bulk and emptied the tables 1 by 1 and ticked them off on a notepad.
Once the tables are emptied in the destination site, go back into each table individually and select IMPORT.
When in the import page at the top left there will be a file browse field, select the relevant file (jos_users for the jos_users table) - remember this is the file from the main site now, that you want to copy into the destination site.
Depending on the size of file this should take only a few seconds.
Repeat this for all 4 of the tables and you should now have all your users copied in from Site A to Site B
You will also need to consider that if you are copying between live sites you may need to change user ID's in components like Virtuemart, K2, and other components that use, user ID's
How to alter settings for front end editing screen in K2
This quick article has been taken from many comments and threads on the K2 community pages and forum, hopefully this will be obsolete when K2 2.5 comes out with these bugs fixed ??
These fixes are for the problem with the front end "add an article" pop up, popping up to big for users with lower res screens.
The second fix is for the save button, that when clicked, does save the file, but doesn't close down the screen. I have both of these working with K2 2.4.1
These are bothhacks and you should remember that when you upgarde to a newer version of K2 these will/may be overwritten
First the SAVE BUTTON
go to components/com_k2/views/item/tmpl/form.php
After string 35: "submitform( pressbutton );"
You can add:
36: parent.$('sbox-window').close(); /* To close modalbox */
37: alert( ' Send ! ' ); /* To view a message */
Second - resizing the pop up screen
You will need to modify the following K2 core files:
components/com_k2/templates/user.php
components/com_k2/templates/default/category.php
components/com_k2/templates/default/item.php
templates/YOURJOOMLATEMPLATE/html/com_k2/templates/user.php
templates/YOURJOOMLATEMPLATE/html/com_k2/templates/YOURK2THEME/category.php
templates/YOURJOOMLATEMPLATE/html/com_k2/templates/YOURK2THEME/item.php
You need to replace the "so famous" rel="{handler:'iframe',size:{x:990,y:650}}"
1) To alter the size of the window in the K2 Login module, find the Userblock.php file, found by; modules/mod_k2_login/tmpl/userblock.php. On or around line 35 (in mine, may vary in yours), find the line;
rel="{handler:'iframe',size:{x:990,y:650}}"
And replace it with this:
rel="{handler:'iframe',size:{x:window.getSize().scrollSize.x-80, y: window.getSize().size.y-80}, onShow:$('sbox-window').setStyles({'padding': 0})}"
In a few words, what this code does is resize the popup window (appears when you click "Add new item" from K2 Login module), conform to your window (not screen) resolution. Then you can see whole the window in a wide view. Well that's what I can see from my laptop. (1280x800)
Note: Maybe you will see many of this rel="{handler:'iframe',size:{x:990,y:650}}" well, just replace all of them to get the problem fixed.
If you want to do this with the component for a better font-end edit just follow these steps:
2)To alter the size of the window in the category add item link, again find the file "Category.php, item.php and User.php"
These can be found by; component/com_k2/templates/default/(category.php/item.php/user.php)
Again find the exact same line as before
rel="{handler:'iframe',size:{x:990,y:650}}" and replace it.
3) To alter the size of the modal window for the "Edit item" link, find the category_item.php file; found by: component/com_k2/templates/default/category_item.php
Do exactly the same as above.
Bonus - Remove the pop up all together and display in a normal window
You can disable the lightbox by removing the class and the rel.
Before:
class="modal" rel="{handler:'iframe',size:{x:window.getSize().scrollSize.x-80, y: window.getSize().size.y-80}, onShow:$('sbox-window').setStyles({'padding': 0})}" h r e f=" < ?php echo $user->profile->addLink; ?> " > < ?php echo JText::_('Add new item'); ? >< /a>
After:
h r e f="< ? php echo $user->profile->addLink; ?> " >
This way you will get a "normal" link to open in a same window or in a new tab.
Just remember remove the class="modal" because if you don't it will display a worst lightbox
Adding a Product
- 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
Adding Manufacturer & Catagory
- 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
Adding a Coupon
- 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
I 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
Show Attributes on Browse Page
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.
Event List - Adding Events in Front End
You will ned to have added a venue first before you can add an event, If you havent already done this , see the add venue tutorial here
You can only edit & add Events in event list if we have set up front end editing on your site for you. If we havent, please get in toch with us and we'll do so.
- Log in using your administrater user name & password
- You may need your antihacker/security login too - a request will pop up in a box if you do.
- Once logged in you will see some extra links show up on your main events or Home Page link in the website - add event & add Venue

- Click on Add Event and add as much information as possible
- Dont forget to save
- Repeat this for as many Events as you have.
Event List - Adding Venues in Front End
You can only edit & add venues in event list if we have set up front end editing on your site for you. If we havent, please get in toch with us and we'll do so.
- Log in using your administrater user name & password
- Once logged in you will see som extra links show up on your main evens link in the website - add event & add Venue

- Click on Add Venu and add as much information as possible
- Dont forget to save
- Do this for as many venus as you have - you need to add venues before you can add an event.