Logo
  • Home
  • Products
    • JEvents
      • JEvents Feature Summary
    • Club Addons
      • RSVP Pro
      • YOOtheme Integration
      • Managed Locations
      • Managed People / Resources
      • Club Themes
      • Iconic Theme
      • Extplus
      • Flatplus Theme
      • FlatUI Theme
      • Float Theme
      • Ruthin Theme
      • Map Theme
      • Social Networking
      • Silver Addons
      • Bronze Addons
      • Free Addons
      • Club Addons Full List
  • Downloads
    • Download JEvents
    • Translations
      • Addon Translations
    • Gold Downloads
    • Silver Downloads
      • Club Themes
    • Social Networking
    • Newsletter Integrations
    • Bronze Downloads
    • Free Downloads
  • Support
    • Forums
    • Documentation
    • Contact Us
  • JEvents Club - Buy
  • FAQs
    • Latest Events - Custom Format Strings
    • Event Detail - Layout Editing
    • Importing Events in CSV format
    • Quick Install Guide
    • Getting Started with Calendars and Categories
    • Custom Module Positions in JEvents
    • Custom Overrides of Language Strings
    • Customising Layouts
    • Time Formatting in JEvents
    • Recreate the Iconic Layout from the Demo Site
    • How can I remove the @ symbol?
    • Time formatting is not working everywhere?
    • Setting Cron Jobs - Non Technical Explanation
    • Migrate Data From One Site To Another
    • Something Went Wrong!
    • Maps not appearing
  • Demo
    • All Events
    • Events at the Zoo
    • Events at the Opera
    • Date Range
    • Location List
    • Major Events
  • LOGIN
You are here: Home Joomla General

General

Custom Prices for Virtuemart Products

Expired

In order to pay for event tickets, which have variable prices which depend on event configuration, with Virtuemart we need a mechanism to create a product with a price we can vary programatically or via a custom product attribute. This can be done with a very simple code modificatio and it will enable you to add variable priced product to VM very easily.

Code Modification

Edit the file administrator/components/com_virtuemart/classes/ps_product.php and find the method get_adjusted_attribute_price at line c.1841 in Virtuemart 1.15 scroll down a little further until you find this line of code:

if( isset( $product_attributes[$this_key]['values'][$this_value] )) {

Then insert the following lines just before this:

// gwe mod
if ($this_key=="ManualPrice"){
   $adjustment = floatval($this_value);
}
// end gwe mod

Create a Product With Adjustable Price

In your product add an attribute called "ManualPrice".

Now when your purchases enters a value in the ManualPrice field and adds the product to the cart it picks up the variable price.

 

Virtuemart Products With No Shipping Requirements

Expired

If you have the need to sell services or products via Virtuemart that don't require shipping then you are out of luck with Virtuemart out of the box.  However with a few simple tweaks to the VM codebasee this can be accomodated.

Virtuemart has a very helpful mechanism for creating downloadable products which we can adapt to skip the shipping step of the checkout.

Code Changes

If you edit the file administrator/components/com_virtuemart/classes/ps_product.php and find the method "is_downloadable" (line 945 in Virtuemart 1.15) and replace it with the following code

	function is_downloadable($product_id) {
		// GWE mod start
		if( empty( $GLOBALS['product_info'][$product_id]['skipshipping'] )) {
		    $db_check = new ps_DB;
			$q_ns = 'SELECT p.product_id from #__{vm}_product as p
					LEFT JOIN #__{vm}_product_category_xref as xr on  p.product_id=xr.product_id
					LEFT JOIN #__{vm}_category as ct on  xr.category_id=ct.category_id
					where p.product_id='.intval($product_id).' AND LOWER(ct.category_name) = "no shipping"';

			$db_check->query($q_ns);
			$db_check->next_record();
			if( $db_check->num_rows() > 0 ) {
				$GLOBALS['product_info'][$product_id]['skipshipping'] = 'Y';
			} else {
				$GLOBALS['product_info'][$product_id]['skipshipping'] = 'N';
			}
		}
		// GWE mod end
		if( empty( $GLOBALS['product_info'][$product_id]['is_downloadable'] )) {
		    $db_check = new ps_DB;
	        $q_dl = "SELECT attribute_name,attribute_value 
	        				FROM #__{vm}_product_attribute WHERE
							product_id=".(int)$product_id." AND attribute_name='download'";
			$db_check->query($q_dl);
			$db_check->next_record();
			if( $db_check->num_rows() > 0 ) {
				$GLOBALS['product_info'][$product_id]['is_downloadable'] = 'Y';
			} else {
				$GLOBALS['product_info'][$product_id]['is_downloadable'] = 'N';
			}
		}
		// GWE mod start
		//return $GLOBALS['product_info'][$product_id]['is_downloadable'] == 'Y';
		return ($GLOBALS['product_info'][$product_id]['is_downloadable'] == 'Y' || $GLOBALS['product_info'][$product_id]['skipshipping'] == 'Y');
		// gwe mod end
	}

Creating Non-Shipping Products

If you look at the code above you may notice that there is a test on a product's category name.  Basically any product we create if we add it into a category called "No Shipping" then in combination with the code change above Virtuemart will skip the shipping stage of the checkout process.

 

  • Cookies
  • Contact Us

JEvents is brought to you by GWE Systems Ltd.   GWE Systems Ltd is Registered in England and Wales under Company Number: 06190845.

Registered Office: Ysgubor Uchaf, Llanfwrog, Ruthin, LL15 2AP, United Kingdom.

Copyright 2025 © JEvents - Events for Joomla

  • Home
  • Products
  • Downloads
  • Support
  • JEvents Club - Buy
  • FAQs
  • Demo
  • Home
  • Products
  • Downloads
  • Support
  • JEvents Club - Buy
  • FAQs
  • Demo
  • Forgot your password?
  • Forgot your username?
  • Create an account
When you are logged in as a JEvents club member you will get an access code that will allow you to update your club addons using the Joomla updater.

Announcing EasyLayouts

GWE Systems Ltd, the company behind JEvents, is excited to announce the preview release of EasyLayouts - the tool that makes it easy to create layouts for your Joomla content and custom fields.

See our blog post for an exciting special offer to our Gold Members