|
Showcase Product Attributes |
|
Written by Thomas Kahl
|
|
Saturday, 06 March 2010 19:15 |
|
You all know the product attributes of Virtuemart. A very useful feature to add options to a product. But the display is a bit boring... Normally you see the attribute groups you add in the product administration as a dropdown on the product flypage. Take a look at what we have done with the attributes: This is all done in the Virtuemart Themes without hacking the core code of Virtuemart!
|
|
Written by Thomas Kahl
|
|
Thursday, 04 March 2010 18:21 |
|
Maybe you have seen this cool website with a very stylish and cool jQuery plugin called "Quicksand". We liked it so much that we wanted to make this available in Virtuemart. Imagine the Virtuemart Browsepage would reorder like this...
Here it is! Watch yourself...
The files for the Virtuemart-Themes will be available from this site as soon as possible...
(If you like the template - it is available at Joomlart.com)
|
|
SEO URL redirect after changes |
|
Written by Thomas Kahl
|
|
Tuesday, 16 February 2010 17:11 |
|
One of the disadvantages of dynamically generated SEO urls is, that they change when the site structure or even alias-names, category-names ... are changed. We just had the request that somebody has entered a test value in his Virtuemart-Menu-Item alias and he wanted to change this to something else.
He first entered "products-mainmenu" to identify it better and now he wanted to change it to "shop". But Google was faster. The whole site with all products was indexed with the "wrong" alias in the URL. After he changed the alias, all the links from Google showed a 404 error.
You could now handle this by writing a little php-script that redirects the wrong URLs to the correct page - but there is an easier and faster way! Edit the .htaccess file in the root-directory of your Joomla-Setup and insert the following line right after the existing line "RewriteEngine On":
RewriteRule ^(.*)wrong-part-of-url(.*)$ http://www.your-domain.com/$1correct-part$2 [R=301,L]
Replace the "wrong-part-of-url" with the old alias (in our case "products-mainmenu"), "your-domain.com" with the domain of your shop and finally "correct-part" with the new alias (in our case "shop").
After that, the searchengine-links will lead to the correct pages and also the searchengine will learn the new URL (done by the code 301 = moved permanently).
|
|
Written by Thomas Kahl
|
|
Saturday, 13 February 2010 18:24 |
|

This year will bring the first international Joomla Conference: Joomla and beyond. You can find all details on the events website www.jandbeyond.de. We hope, that Virtuemart as one of the most important Joomla extensions will be also part of the event. To assure this, we have added two session-proposals for the event. It is possible to vote for sessions. If you are interested, please head over and vote for the sessions:
|
|
Security Fix for VM 1.1.4 |
|
Written by Thomas Kahl
|
|
Thursday, 28 January 2010 03:20 |
|
Today we saw a message on Twitter that Virtuemart has a SQL-Injection problem. This refers to the alert http://www.securityfocus.com/bid/37963/info.
As you can see from the exploit description, this problem only occurs when somebody is logged into the Joomla administration. I would say that this makes it a minor problem - but nervertheless it should be fixed.
We have just uploaded a fix to the virtuemart development server (SVN). If you want to fix the problem on your own before the patch is released, please edit /administrator/components/com_virtuemart/html/order.order_status_form.php and replace line 23 with the following line:
$order_status_id =vmrequest::getInt('order_status_id', 0);
Now the submitted parameter is converted to an integer and no code can be injected to the query.
|
|
Hide Bottom Pagination in Virtuemart |
|
Written by Thomas Kahl
|
|
Monday, 04 January 2010 22:37 |
|
Virtuemart shows the bottom pagination even when there is only one page. This doesn’t make sense and a lot of people want to hide this. I have seen some tips where a core hack is suggested. As all of us know, for each core hack god kills a little cat – so if you like cats, don’t do it.
There is a very simple way to hide the pagination with a little change in the pagination theme:
/components/com_virtuemart/themes/default/templates/browse/includes/browse_pagenav.tpl.php
Replace the original content with the following code:
<?php if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' ); mm_showMyFileName(__FILE__); ?>
<?php if(!@is_object( $pagenav)) return; ?>
<?php
$pag_string=$pagenav->getPagesLinks( $search_string );
if(!strpos($pag_string,'href')) return; ?>
<!-- BEGIN PAGE NAVIGATION -->
<div id="footervmnav">
<?php $pag_string; ?>
</div>
<!-- END PAGE NAVIGATION -->
and save th file. Now the pagination should be gone if not needed.
The “trick” is in line 5 and 6:
$pag_string=$pagenav->getPagesLinks( $search_string ); if(!strpos($pag_string,'href')) return;
Here we first store the pagination-string to a variable. After that, we check if there is a link contained in the string (check for ‘href’). If not, we return without displaying the pagination.
|
|
Extending Virtuemart 1.1.4 |
|
Written by Thomas Kahl
|
|
Saturday, 17 October 2009 08:36 |
|
As you might know, we always want to avoid changes in the Virtuemart code when we write addons or add features our customers need. Sure, this is not always possible. But in most cases, we find a solution without hacking the core code. The themes (available since 1.1.x) were a big step forward but Virtuemart 1.1.4 goes one step further. We have added a new directory in the themes: /components/com_virtuemart/themes/your_theme_name/user_class This directory can hold a replacement or extension of all classes that exist in /administrator/components/com_virtuemart/classes. Technically, Virtuemart checks if there is a file in the user_class-directory and uses this class to extend the original Virtuemart class. If such a file is not found, the original class is used without extension. This works similar to the Template Overrides in Joomla 1.5 - this is not the “clean” OOP-way, but this way, we could make sure that existing addons still work with this structure. To extend Virtuemart is now much easier! Maybe you want to be informed when a new product was added: Just create this new file: /components/com_virtuemart/themes/your_theme_name/user_class/ps_checkout.php and put the following code into the file:
if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
class ps_product extends vm_ps_product {
function add( &$d ) {
$retval=vm_ps_product::add(&$d);
if ($d['product_id']) {
$message='A new product has been added to your shop:
ID: '.$d['product_id'].' SKU: '.$d['product_sku'].' Name: '.$d['product_name'];
vmMail( "
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
", "ShopAdmin", "
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
", "New Product", $message, false, true);
}
}
}
What does this code do?
- The first line should be in every skript that is called within Joomla – this makes sure, that the code cannot be called directly.
- In the second line, we create the class ps_product, which is the “original” classname. We extend the core virtuemart class vm_ps_product. That means, that we use everything from the core-class except the functions we have written on our own.
- The third line creates the function “add”. This function already exists in the core class. We could have copied the whole function here and change the things we want to add. But because we want to use as much core code as possible, we call the original core-function in the fourth line. This way, we make sure that virtuemart does everything that is needed in the process.
- In the fifth line we check, if a new product was created by checking if a product_id was created. If this is true, we can send an email to somebody to inform him/her that a new product was created. Of course you can add some code here to retreive the emailaddress dynamically. This is just an example.
As you can see, with some lines of code, we have added a new feature to Virtuemart without hacking the core code.
Security!
Everybody who has FTP-access to your site can add files to this user_class directory. Please keep this in mind. You can enable or disable the execution of the user_classes by setting the flag in the virtuemart-administration on the “security” tab. Please keep in mind, that you change the core behavior of virtuemart by adding user_classes. Be sure that your code is correct and secure – otherwise you might produce errors in your onlineshop.
Why in the themes?
You might ask, why the user_classes are stored in the themes directory and not in the admin-directorytree. That was discussed during the development. But i found it important, that everything that is changed or added for a customers shop is in one place. This way, you have all the custom development for your Virtuemart shop within one directory tree. Easy to backup and transport to another installation.
I hope this will be usefull for most Virtuemart developers and may help reduce the number of core-hacks out there.
|
|
Multiple Shops with one Shop Administration |
|
Written by Thomas Kahl
|
|
Saturday, 10 October 2009 00:37 |
|
 We are often asked if it is possible to run two or more shops with just one Joomla / Virtuemart setup and one administration. The default answer to this question is “No. Virtuemart does not offer this feature.”. But – yes, there is always a “but” – of course it is possible! We have done several projects with Virtuemart where the customer runs different shops with one administration. See some examples here: Tagesspiegel (germany) is the main Virtuemart Setup: http://shop.tagesspiegel.de/index.php in the same Virtuemart administration, the following shops are managed: http://shop.pnn.de/index.php http://shop.zitty.de/index.php Another example (german, too): Willkommen im Online Shop der Saarbrücker Zeitung (Main setup) Willkommen im Online Shop der Pfälzischen Merkur (managed through the main setup) As you can see, the shops have different layouts and (much more important) different categories and products. There are also products that are sold in more than one shop. How can this be done? With a bit of knowledge about how Virtuemart works and database know how we have created a solution, that (surprise) works without any Virtuemart or Joomla hacks! It’s a combination of advanced database configuration and a set of components and modules. The big advantage is, that you can decide which data shall be “synchronized” between the different shops and which shall be used by all the shops together. Example: you want to run three shops with different and identical products. Two of the shops shall share the userbase. This can be configured. You decide for each product in which shop it is visible. In the database, it is configured that shop 1 and shop 2 have the same user-table and shop 3 has its own table. The orders are stored in each shop. This solution is very flexible and it will work with all existing Virtuemart and Joomla extensions, because all the changes we make are not “visible” for Joomla and Virtuemart. They access the database tables like always. Under the hood, the database delivers and stores the data the way we configured it. Unfortunately, this solution is not available “out of the box” as a component. It has to be discussed, configured and integrated. But the result is a fast and easy to manage set of shops. If you are interested in such a solution, please contact us for a quote!
|
|
Virtuemartday Germany 2009 |
|
Written by Thomas Kahl
|
|
Saturday, 26 September 2009 16:04 |
|
On wednesday, 24th Sept. 2009, the second Virtuemartday took place in germany as a part of the german joomladays (Website: joomladay.de, Twitter Hashtag: #jd09de). We were part of the organizers of the whole event and also speaker on all days. On the virtuemartday we had a training-track “Virtuemart from A to Z” with an additional FAQ for all things that were not answered in the training. In the second track we had a session about the current virteumart status (1.1.x), the next step (1.5) and the future (Virtuemart 2) which was very interesting. The slides of this presentation (german) are available for download soon. After that, our partner “Paypal” has presented the upcoming Paypal Platform and the Paypal Express Checkout we have developed for Virtuemart. The guys from Joomla-Remote have presented their solution for managing Virtuemart and Joomla from a windows application. After the delicious lunch the “Virtuemart A to Z” track continued and we started our session “Getting the most out of Virtuemart” where we showed what can be done with virtuemart by showing live examples followed by the tips and ways how to realize it in the themes and upcoming userclasses (VM 1.1.4) The last session of the day was held by a lawyer about “the law compliant online shop” (is there a better translation?). This session was very popular, so the other planned session wasn’t held. Overall, it was a very successful day and we have received very nice compliments (but also suggestions for improvements) from the audience. Pictures, slides and additional information coming soon…
|
|
Useful SQL Queries for Virtuemart |
|
Written by Thomas Kahl
|
|
Monday, 21 September 2009 13:42 |
|
We would like to publish some useful SQL queries from time to time that may help you gather information from your shop. The queries are written to copy and paste them directly to phpMyAdmin or similar database clients. If you want to use them in your code, please replace the prefix “jos_vm_” with “#__{vm}_” to make it work with the database class of virtuemart. Also, if you have another prefix chosen for your tables, replace the string with your prefix. Sum up monthly order totals This query selects the order_total from the orders table and displays monthly sums. The query selects only orders with the order-status “C”. SELECT sum(order_total) as totalamount, year(from_unixtime(mdate)) as totalyear, month(from_unixtime(mdate)) as totalmonth, monthname(from_unixtime(mdate)) as totalstrmonth FROM `jos_vm_orders` WHERE `order_status`="C" group by totalyear, totalmonth order by totalyear asc, totalmonth asc
|
|
|