Main Menu
Login





Lost Password?
Who's Online
Newsflash
VirtueMart Maintenance Release 1.0.15

All current mods are compatible with VM 1.0.15
 
Latest Forum Posts
Home
Product Types Modification PDF Print E-mail
1_4.jpgA product types are very handy, they are away of adding extra data to your VM catalogue that are not covered by the internal structure. They can also be used for advanced searching. E.g. you could set up a product type that has car makes and models. If you also selct a set of default values you can do a search usng dropdown boxes. Not intelligent in that it nows that Make A as models x,y & z but useful none the less. The only problem with product_types is that they display in a grid with each label displayed then the value and units (If specified)!

Until now!

Download : Product Type Modification


This mod which updates the product types file and a few lines of code to add to your shop.product_details.php file. I could supply the files already modded, but I have to take into account a normal build, childlist, lightbox and childlist with lightbox builds. Thats 4 different files for just 4 lines of code! Overkill!

This mod allows you to indivually place product type fields anywhere on your flypage. You could have some before the description, 1 beside the price, 2 next to the image etc. It's completely up to the site designer. Instaed of having one tag {product_types} you have 2 tags for each field, 1 for the label and 1 for the data.

So you could have a product type with a name of test_type with fields field_1, field_2 and field_3. so now you have six tags.

{test_type:field_1_label} {test_type:field_1} {test_type:field_2_label} {test_type:field_2} {test_type:field_3_label} {test_type:field_3} and perhaps you have another product type of second_type with just 1 field then you would have a tag of {second_type:new_field}.

So you can see how this could be used, you no longer have your grid with the annoying title of 'Parameters of Category: test_type'.

And if you have been clever enough to work out how to use the custom flypages with product types (They are not flypages, more like extensions!) they can be placed seperately from the standard tags e.g. you have a product_type of custom using a flypage of custom_type then you would just have a new tag of {custom}.

I'll put up a tutorial on product types and how to write your own flypages for them which will enable to do some neat things.

Installation

There is just one file to replace, unpack the archive and copy the file to your-site/administrator/components/com_virtuemart/classes.

*Back up ps_product_type.php before overwriting.

Then edit the file shop.product_details.php in your-site/administrator/components/com_virtuemart/html

Near the end of the file you will find a block code such as this.

if ($product_parent_id!=0 && !$ps_product_type->product_in_product_type($product_id)) {
      $product_type = $ps_product_type->list_product_type($product_parent_id);
  }
  else {
    $product_type = $ps_product_type->list_product_type($product_id);
  }


change it to this

$product_type = array();
if ($product_parent_id!=0 && !$ps_product_type->product_in_product_type($product_id)) {
      $product_type = $ps_product_type->list_product_type($product_parent_id);
  }
  else {
    $product_type = $ps_product_type->list_product_type($product_id);
  }


Just below this you will find this line

$template = str_replace( "{product_type}", $product_type, $template ); // Changed Product Type



replace it with this

if(is_array($product_type)) {
    foreach($product_type as $p_type => $key) {
        $template = str_replace( "{".$p_type."}",$key,$template);
    }
}

Thats all there is to it

Discuss this article on the forums. (21 posts)



No comments...

Only registered users can write comments.
Please login or register.

 
Google Search
Google
Newsletter
Subscribe for updates to my modifications.





VirtueMart
Child List LightBox & MoreImages Advanced Discount Mod


Advanced Search
Your Cart
Your Cart is currently empty.
Latest downloads
Top Downloads
Donate
Help me to continue development of these modifications by donating.


Advertisement