VirtueMart Forum

VirtueMart 2 + 3 => General Questions => Topic started by: giriga on December 09, 2016, 13:23:07 pm

Title: Custom fields are generated by default Virtuemart script
Post by: giriga on December 09, 2016, 13:23:07 pm
I miss the selection, When the customer chooses the image, how can you do? see image example

My website
sample site

Regards
Title: Re: Custom fields are generated by default Virtuemart script
Post by: Studio 42 on December 09, 2016, 17:09:55 pm
Hi,
If you need to get in in the cart, i think it's not possible.
If you need advanced option, you need to find a plugin that can use images in cart.
But your explain are to short to help you.
Perhaps in the website directly we can find the problem if you provide a link ?
Title: Re: Custom fields are generated by default Virtuemart script
Post by: giriga on December 09, 2016, 19:16:42 pm

hi,
I would need that when you click and choose the finish that you like in the cart, turning on the picture I am attaching link my site and link the sample site:

http://prova.giriga.com/negozio-online/tavoli-sedie/sgabello-tom-detail.html (my site)

http://shop.bertoliarredamenti.it/shop/complementi-bontempi/scrittoio-zac-bontempi/  (sample site)

Best regards
Title: Re: Custom fields are generated by default Virtuemart script
Post by: giriga on December 09, 2016, 19:25:00 pm
hi,

If you report me a plugin that does this thanks

http://shop.bertoliarredamenti.it/shop/tavoli/tavolo-echo-in-bontempi/

woocommerce I know there has, I hope that virtuemart
Title: Re: Custom fields are generated by default Virtuemart script
Post by: Studio 42 on December 09, 2016, 21:12:30 pm
Only simple solution i know in css :
fist css rule is for unselected radio, second for selected radio input
Code: [Select]
.product-field-display input[type="radio"]+img {
    border: 2px solid #fff;
}
.product-field-display input[type="radio"]:checked+img {
    border: 2px solid #0aa64c;
}
Note you have to set same border width else you have some rendering problems
Title: Re: Custom fields are generated by default Virtuemart script
Post by: giriga on December 09, 2016, 22:09:41 pm
Thank you very much !! I solved the problem  ;D ;D

best regards
Title: Re: Custom fields are generated by default Virtuemart script
Post by: giriga on December 12, 2016, 22:36:22 pm
Hello, I'd also like to see the name of the image (I include photos)
Title: Re: Custom fields are generated by default Virtuemart script
Post by: Studio 42 on December 13, 2016, 01:04:23 am
In the product details or in the cart ?
Title: Re: Custom fields are generated by default Virtuemart script
Post by: giriga on December 14, 2016, 11:09:54 am
Hello is the custom field virtuiemart picture I am attaching the link?

http://prova.giriga.com/negozio-online/tavoli-sedie/sgabello-tom-detail.html
Title: Re: Custom fields are generated by default Virtuemart script
Post by: Studio 42 on December 14, 2016, 11:46:11 am
To display info after image, you need to modify the code and add original VM code

HERE is the original code to integgrate in \components\com_virtuemart\sublayouts\customfield.php line 472
search for
Code: [Select]
if($type == 'M'){
$tmp = array('value' => $val, 'text' => VirtueMartModelCustomfields::displayCustomMedia ($val,'product',$customfield->width,$customfield->height));

Code: [Select]
static function displayCustomMedia ($media_id, $table = 'product', $width = false, $height = false, $absUrl = false) {

if (!class_exists ('TableMedias'))
require(VMPATH_ADMIN . DS . 'tables' . DS . 'medias.php');

$db = JFactory::getDBO ();
$data = new TableMedias($db);
$data->load ((int)$media_id);
if(!empty($data->file_type)){
$table = $data->file_type;
}

if (!class_exists ('VmMediaHandler'))
require(VMPATH_ADMIN . DS . 'helpers' . DS . 'mediahandler.php');
$media = VmMediaHandler::createMedia ($data, $table);

if(!$width) $width = VmConfig::get('img_width',90);
if(!$height) $height = VmConfig::get('img_height',90);

return $media->displayMediaThumb ('', FALSE, '', TRUE, TRUE, $absUrl, $width, $height);
}

and try to add this and modify
return $media->displayMediaThumb ('', FALSE, '', TRUE, TRUE, $absUrl, $width, $height);
with
return $media->displayMediaThumb ('', FALSE, '', TRUE, TRUE, $absUrl, $width, $height, true);
of course you need to change some codes.
Title: Re: Custom fields are generated by default Virtuemart script
Post by: giriga on December 14, 2016, 13:28:22 pm
hello, I'm sorry I tried to change the code, but it gives me error:
Title: Re: Custom fields are generated by default Virtuemart script
Post by: giriga on December 15, 2016, 18:17:59 pm
This is the error that appears after changing the code :

 0 - There was an error.

syntax error, unexpected 'displayCustomMedia' (T_STRING), expecting '('

JGLOBAL_TPL_CPANEL_LINK_TEXT
Title: Re: Custom fields are generated by default Virtuemart script
Post by: Studio 42 on December 15, 2016, 23:46:09 pm
You need to implement the code , not use is exactly.
I only grouped you the 2 codes, so you have all info to do it yourself.
Title: Re: Custom fields are generated by default Virtuemart script
Post by: giriga on December 16, 2016, 16:43:56 pm
Hello, thanks for the reply, unfortunately I am not a programmer, there is a tutorial where you can watch?
Title: Re: Custom fields are generated by default Virtuemart script
Post by: giriga on December 17, 2016, 16:05:00 pm
there maybe a module or plugin that does all this?
Title: Re: Custom fields are generated by default Virtuemart script
Post by: Studio 42 on December 18, 2016, 09:56:46 am
Try to add after
Code: [Select]
if($type == 'M'){
Code: [Select]
$width = $customfield->width;
$height = $customfield->height;
$table = 'product';
$absUrl = false;
if (!class_exists ('TableMedias'))
require(VMPATH_ADMIN . DS . 'tables' . DS . 'medias.php');

$db = JFactory::getDBO ();
$data = new TableMedias($db);
$data->load ((int)$val);
if(!empty($data->file_type)){
$table = $data->file_type;
}

if (!class_exists ('VmMediaHandler'))
require(VMPATH_ADMIN . DS . 'helpers' . DS . 'mediahandler.php');
$media = VmMediaHandler::createMedia ($data, $table);

if(!$width) $width = VmConfig::get('img_width',90);
if(!$height) $height = VmConfig::get('img_height',90);
$tmp = array('value' => $val, 'text' => $media->displayMediaThumb ('', FALSE, '', TRUE, TRUE, $absUrl, $width, $height);

and comment original line :
Code: [Select]
$tmp = array('value' => $val, 'text' => VirtueMartModelCustomfields::displayCustomMedia ($val,'product',$customfield->width,$customfield->height));
Title: Re: Custom fields are generated by default Virtuemart script
Post by: giriga on December 18, 2016, 12:31:49 pm
I have done as you say, keeps giving error: 0 - There was an error.

syntax error, unexpected ';', expecting ')'

JGLOBAL_TPL_CPANEL_LINK_TEXT, enclose the complete code:

Title: Re: Custom fields are generated by default Virtuemart script
Post by: Studio 42 on December 18, 2016, 12:59:53 pm
$tmp = array('value' => $val, 'text' => $media->displayMediaThumb ('', FALSE, '', TRUE, TRUE, $absUrl, $width, $height);
replace with
$tmp = array('value' => $val, 'text' => $media->displayMediaThumb ('', FALSE, '', TRUE, TRUE, $absUrl, $width, $height));
I worte it directly.
But best is to activate php error display in Joomla config or in your server
Title: Re: Custom fields are generated by default Virtuemart script
Post by: giriga on December 19, 2016, 12:13:09 pm
hello, with the modification to the code
$ Tmp = array ('value' => $ val, 'text' => $ media-> displayMediaThumb ('', false, '', TRUE, TRUE, $ absUrl, $ width, $ height)); now works ! But it does not appear the image name if I click it

Title: Re: Custom fields are generated by default Virtuemart script
Post by: Studio 42 on December 19, 2016, 18:23:11 pm
Change
Code: [Select]
$tmp = array('value' => $val, 'text' => $media->displayMediaThumb ('', FALSE, '', TRUE, TRUE, $absUrl, $width, $height));with
Code: [Select]
$tmp = array('value' => $val, 'text' => $media->displayMediaThumb ('', FALSE, '', TRUE, TRUE, $absUrl, $width, $height,true));
Title: Re: Custom fields are generated by default Virtuemart script
Post by: giriga on December 19, 2016, 21:59:35 pm
It's sorry, still does not work ...

http://prova.giriga.com/negozio-online/tavoli-sedie/sgabello-tom-detail.html

this is the code

if (! $ width) $ width = VmConfig :: get ('img_width', 90);
if (! $ height) height = $ VmConfig :: get ('img_height', 90);
$ Tmp = array ('value' => $ val, 'text' => $ media-> displayMediaThumb ('', false, '', TRUE, TRUE, $ absUrl, $ width, $ height, true));
Title: Re: Custom fields are generated by default Virtuemart script
Post by: Milbo on December 19, 2016, 23:01:44 pm

$ Tmp =

must be $Tmp.... there is no space allowed between $ and the variable name.
Title: Re: Custom fields are generated by default Virtuemart script
Post by: giriga on December 20, 2016, 12:54:31 pm
Hello, in fact the space there is, the code written it with Notepad ++
Title: Re: Custom fields are generated by default Virtuemart script
Post by: Studio 42 on December 20, 2016, 13:23:38 pm
Hum, i think you do need to add the new parameter.
but to display escription you need to fill "file_description" for the images.
Title: Re: Custom fields are generated by default Virtuemart script
Post by: giriga on December 20, 2016, 13:29:55 pm
Hi, where file_description? What should I change? I'm sorry
Title: Re: Custom fields are generated by default Virtuemart script
Post by: giriga on December 20, 2016, 16:16:03 pm
Hello I am attaching image
Title: Re: Custom fields are generated by default Virtuemart script
Post by: Studio 42 on December 20, 2016, 22:57:17 pm
Fill all the empty fields.
You can copy / paste same value.
If you have many, you can buy my tool here : http://shop.st42.fr/en/products/vm-be-pro-batch-product-edit.htm and edit directly the image informations in the images list. I added this feature in the last releases.
Title: Re: Custom fields are generated by default Virtuemart script
Post by: giriga on December 21, 2016, 10:41:54 am
Hello, I have filled all the blanks, but if you step over the image with your mouse nothing appears:
Title: Re: Custom fields are generated by default Virtuemart script
Post by: giriga on December 21, 2016, 10:44:52 am
http://prova.giriga.com/negozio-online/tavoli-sedie/sgabello-tom-detail.html
Title: Re: Custom fields are generated by default Virtuemart script
Post by: Studio 42 on December 21, 2016, 10:45:38 am
Hello, I have filled all the blanks, but if you step over the image with your mouse nothing appears:
You need to add a javascript eg. bootstrap tooltip.
Title: Re: Custom fields are generated by default Virtuemart script
Post by: giriga on December 21, 2016, 22:09:42 pm

there is a form or easier way to fix it thanks very much
Title: Re: Custom fields are generated by default Virtuemart script
Post by: Studio 42 on December 22, 2016, 08:45:18 am
If you don't want hack the Virtuemart core code, it's the only way.
Most time tooltip is already loaded(by bootstrap.js) but not called in your template. So you only need some lines of javascript and it work.
Title: Re: Custom fields are generated by default Virtuemart script
Post by: giriga on December 22, 2016, 13:23:33 pm
Thank you for your response, you can have a guide how to do? thanks very much, unfortunately neophyte in this area
Title: Re: Custom fields are generated by default Virtuemart script
Post by: Studio 42 on December 22, 2016, 20:04:15 pm
http://getbootstrap.com/javascript/#tooltips for bootstrap 3
Or
http://getbootstrap.com/2.3.2/javascript.html#tooltips for bootstrap 2
Title: Re: Custom fields are generated by default Virtuemart script
Post by: giriga on December 23, 2016, 11:18:49 am
Excuse me, where you are bootstrap.js? in the template? I do not know where to look
Title: Re: Custom fields are generated by default Virtuemart script
Post by: Studio 42 on December 23, 2016, 13:17:12 pm
I have give you all you need.
Sorry but you need now to find yourself or check with a developper if you don't understand how to add javascript code.
Search in Google : "add script in Joomla" 
https://www.google.fr/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=add+script+in+Joomla&lr=lang_en