News:

Support the VirtueMart project and become a member

Main Menu

product image from web link

Started by mladen88, December 23, 2011, 19:37:38 PM

Previous topic - Next topic

mladen88

How to setup link for main product image in VM 2.0   Ill try to insert link but no result.
My wholeseller got pictures online and I dont wont download and upload picture in VM.
Example of web picture is
https://content.it4profit.com/pimg/s/resize/400x300x400x300/101230123933488776.jpg

PRO

I know this was not setup a while back.

I dont think its in the core yet

911websiterepair

but  there a hack for this in 1.1.9


you should be able to load images from a remote server, i i have the hack,    but FYI,   if you have a 1000 customers, and they all try to access that image at the same time,   it will not load on your site.
joomla components, modules and extensions @ http://www.madeforjoomla.com
joomla development, customizations and repair speshitpillts, http://www.911websiterepair.com

Virtuemart 2.0 PayPalPro Module
Virtuemart 2.0 Fedex Shipping Module
Virtuemart 2.0 Express Order Module
Virtuemart 2.0 Authorize.net SIM payment module
http://www.virtuemartmailordermanager.com

Studio 42

mladen you can create a custom product plugin to add such extention.
Look in plugin/vmcustom/ to see  how to do.
YOu don't have to hack the core but simply write a little plugin !

mladen88

Ill try VM demo online (version 1.8) and picture link work perfect in this version. I dont understand why this valuable feature is removed from 2.0 version. In my case wholesale stock (lager) is frequently change and I must frequently change all product info. Downloading images and description is time-consuming (description is also online card on wholesale server and I just embed it in description field)
In this moment I consider install version 1.8

@geekhead there is no problem about server -max 5 customers at same time is on my page and wholesale server is powerfull.

@Electrocity  In plugins/vmcustom there is just empty index file. I dont know where to start because I am not developer and my knowledge of PHP is very basic.

Thanx for answers

Studio 42

You must add the AIO provided in the vm2 final pack
You have 2 plugins in plugins/vmcustom

One is specification.php and use a table.

The table name is always #_virtuemart_product_custom_plg_NAMEOFPLUGIN

YOu can reuse it on changing on or 2 parameters and renaming it.
in plgVmOnDisplayProductFE you simple have to add the code to render your link
eg
function getTableSQLFields() {
$SQLfields = array(
    'id' => 'int(11) unsigned NOT NULL AUTO_INCREMENT',
    'virtuemart_product_id' => 'int(11) UNSIGNED DEFAULT NULL',
    'virtuemart_custom_id' => 'int(11) UNSIGNED DEFAULT NULL',
    'custom_image_url' => 'char(256) NOT NULL DEFAULT \'\' ',
    'custom_image_thumb' => 'char(256) NOT NULL DEFAULT \'\' ',
);

return $SQLfields;
}
function plgVmOnProductEdit($field, $product_id, &$row,&$retValue) {
if ($field->custom_element != $this->_name) return '';
$this->parseCustomParams($field);
$this->getPluginProductDataCustom($field, $product_id);

$html ='<div>';
$html .='<div>'.$html =JTEXT::_('VMCUSTOM_IMAGE_LINK_DESC')) .'</div>';
$html .='<input type="text" value="'.$field->custom_url.'" size="10" name="plugin_param['.$row.']['.$this->_name.'][custom_image_url]">';
$html .='<div>'.$html =JTEXT::_('VMCUSTOM_IMAGE_THUMBLINK_DESC')) .'</div>';
$html .='<input type="text" value="'.$field->custom_url.'" size="10" name="plugin_param['.$row.']['.$this->_name.'][custom_image_thumburl]">';
$html .='</div>';
$retValue .= $html  ;
$row++;
return true  ;
}

function plgVmOnDisplayProductFE($product,&$idx,&$group) {
// default return if it's not this plugin
if ($group->custom_value != $this->_name) return '';

$this->_tableChecked = true;
//$this->tableFields = array ( 'id', 'virtuemart_custom_id', 'custom_url');

$this->parseCustomParams($group);
$this->getPluginProductDataCustom($group, $product->virtuemart_product_id);

// Here the plugin values
$group->display .= '<div><a class="modal" href="'.$group->custom_image_url.'" '.<img alt="$product->product_name" src="'.$group->custom_image_thumburl.'"></a></div>';

return true;
}

>>THIS CODE IS WRITING FROM SCRATCH and have to be completed !
Now you have the basic code to do it.

After on update your product the product_id is in the table and with an Xref relation with product_id, you can simply update you  custom plugin

Plz, look the specification.php plugin to have a good sample

Bergami

Hi,

has anyone created this plugin successfully ?

Thanks
Bergami

robgib0

Quote from: Electrocity on December 26, 2011, 20:48:36 PM
You must add the AIO provided in the vm2 final pack
You have 2 plugins in plugins/vmcustom

One is specification.php and use a table.

The table name is always #_virtuemart_product_custom_plg_NAMEOFPLUGIN

YOu can reuse it on changing on or 2 parameters and renaming it.
in plgVmOnDisplayProductFE you simple have to add the code to render your link
eg
function getTableSQLFields() {
$SQLfields = array(
    'id' => 'int(11) unsigned NOT NULL AUTO_INCREMENT',
    'virtuemart_product_id' => 'int(11) UNSIGNED DEFAULT NULL',
    'virtuemart_custom_id' => 'int(11) UNSIGNED DEFAULT NULL',
    'custom_image_url' => 'char(256) NOT NULL DEFAULT \'\' ',
    'custom_image_thumb' => 'char(256) NOT NULL DEFAULT \'\' ',
);

return $SQLfields;
}
function plgVmOnProductEdit($field, $product_id, &$row,&$retValue) {
if ($field->custom_element != $this->_name) return '';
$this->parseCustomParams($field);
$this->getPluginProductDataCustom($field, $product_id);

$html ='<div>';
$html .='<div>'.$html =JTEXT::_('VMCUSTOM_IMAGE_LINK_DESC')) .'</div>';
$html .='<input type="text" value="'.$field->custom_url.'" size="10" name="plugin_param['.$row.']['.$this->_name.'][custom_image_url]">';
$html .='<div>'.$html =JTEXT::_('VMCUSTOM_IMAGE_THUMBLINK_DESC')) .'</div>';
$html .='<input type="text" value="'.$field->custom_url.'" size="10" name="plugin_param['.$row.']['.$this->_name.'][custom_image_thumburl]">';
$html .='</div>';
$retValue .= $html  ;
$row++;
return true  ;
}

function plgVmOnDisplayProductFE($product,&$idx,&$group) {
// default return if it's not this plugin
if ($group->custom_value != $this->_name) return '';

$this->_tableChecked = true;
//$this->tableFields = array ( 'id', 'virtuemart_custom_id', 'custom_url');

$this->parseCustomParams($group);
$this->getPluginProductDataCustom($group, $product->virtuemart_product_id);

// Here the plugin values
$group->display .= '<div><a class="modal" href="'.$group->custom_image_url.'" '.<img alt="$product->product_name" src="'.$group->custom_image_thumburl.'"></a></div>';

return true;
}

>>THIS CODE IS WRITING FROM SCRATCH and have to be completed !
Now you have the basic code to do it.

After on update your product the product_id is in the table and with an Xref relation with product_id, you can simply update you  custom plugin

Plz, look the specification.php plugin to have a good sample


so copy the plugin code from that folder......rename it?
i want to use an image link for products that is generated on a third party image site

and comes in the form of javascript link


<script type="text/javascript">var imageref = 'D223'; var licence = 'WEBD-1102-TMXB-1222-YIDD-1721-RJQD'; var imagesize = 'full';</script>
<script type="text/javascript" src="http://www.gapphotos.com/javafiles/createpdbimagelink.js"></script>



how would i incorporate that into the script................and will product details page have an input field for this link??


John2400

Hi guys,

I use VM 2.0.2 and JM 2.5.1 and I also use the web links to display products. I don't have 100 or 1000s like some of you but
I could copy the URL image of mladen88 and paste it (URL) in my shop perfectly.

I pasted it in Products>>product images>>image information>used URL and it worked.

Just so others might know that an individual product can go in and the image can be changed else where.

I did not use any special plug in



robgib0

thanks for that ,..................but my image links are linked to a database which generates a javascriptlink to display an image

AngelinaC

I used to have a customer who inadvertently copied the links instead of adding images locally.   It worked until the system administrator blocked the links and they spent all that time and work for nothing.    Make sure the vendor REALLY is ok with this before you assume they will be.  Just a caution. 
joomla 2.5.4 / VM 2.0.2