Author Topic: product image from web link  (Read 3382 times)

mladen88

  • Beginner
  • *
  • Posts: 2
product image from web link
« on: December 23, 2011, 19:37:38 pm »
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

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10362
  • VirtueMart Version: 3+
Re: product image from web link
« Reply #1 on: December 23, 2011, 20:25:54 pm »
I know this was not setup a while back.

I dont think its in the core yet
J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

911websiterepair

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 253
  • We Can Do It!!
    • Virtuemart Programming and Customization Help - C H E A P !!!
  • Skype Name: mjones1256
Re: product image from web link
« Reply #2 on: December 23, 2011, 20:28:43 pm »
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 spemildts, 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

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4016
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: product image from web link
« Reply #3 on: December 23, 2011, 21:49:32 pm »
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

  • Beginner
  • *
  • Posts: 2
Re: product image from web link
« Reply #4 on: December 24, 2011, 14:58:03 pm »
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

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4016
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: product image from web link
« Reply #5 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
Code: [Select]
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

  • Beginner
  • *
  • Posts: 1
Re: product image from web link
« Reply #6 on: February 24, 2012, 09:30:48 am »
Hi,

has anyone created this plugin successfully ?

Thanks
Bergami

robgib0

  • Beginner
  • *
  • Posts: 3
Re: product image from web link
« Reply #7 on: February 25, 2012, 11:24:25 am »
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
Code: [Select]
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


Code: [Select]
<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

  • Virtuemart - the Future is ever Changing
  • Global Moderator
  • Full Member
  • *
  • Posts: 1568
  • VirtueMart Version: Use VM3.0.12
Re: product image from web link
« Reply #8 on: February 26, 2012, 00:18:39 am »
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

  • Beginner
  • *
  • Posts: 3
Re: product image from web link
« Reply #9 on: March 02, 2012, 17:01:40 pm »
thanks for that ,..................but my image links are linked to a database which generates a javascriptlink to display an image

AngelinaC

  • Jr. Member
  • **
  • Posts: 111
Re: product image from web link
« Reply #10 on: March 04, 2012, 06:49:25 am »
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