Created
October 15, 2014 19:56
-
-
Save jlainezs/9e3f451839c6ff7423d1 to your computer and use it in GitHub Desktop.
Virtuemart 2.0 snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*** | |
* Link product images for virtuemart 2.0 | |
* | |
* Heads up: | |
* - Do a backup of your site | |
* - Images are stored on the virtuemart product images directory (e.g. images/stories/virtuemart/product) | |
* - Images are named sku.jpg, where sku is the SKU of a product | |
* - Run a media sync operation on the Virtuemart Media Manager | |
* | |
* Before running this script you should change the prefix (bxhu5) of the tables | |
* | |
*/ | |
insert into bxhu5_virtuemart_product_medias (virtuemart_product_id, virtuemart_media_id, ordering) | |
select fn.virtuemart_product_id, m.virtuemart_media_id, 1 | |
from bxhu5_virtuemart_medias m | |
inner join (SELECT virtuemart_product_id, concat(product_sku,'.jpg') as filename from bxhu5_virtuemart_products) fn | |
on fn.filename = m.file_title; | |
-- This is optional. It sets the image title using the product name. | |
-- For different languages, change the _en_gb (_fr_fr for French) | |
update bxhu5_virtuemart_medias m | |
inner join bxhu5_virtuemart_product_medias pm on m.virtuemart_media_id = pm.virtuemart_media_id | |
inner join bxhu5_virtuemart_products_en_gb p on p.virtuemart_product_id = pm.virtuemart_product_id | |
set | |
m.file_description=p.product_name; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment