Post by kryul » Sat Oct 13, 2018 6:23 am

Hi Experts,

I am very newbie into OC Store, and I am asking you for help.

I am using a bulk upload of products (XLSX) into my ocstore shop.
image_name is set as http://another_web_site.com/some_folder/images/product01.jpg

As long as we have more that 10 000 products, I would not like to duplicate (copy) the images into our web_site, too. I would prefer to use remote files and display them as images at my shop's page.

ISSUE: Import was successful. However, I do not see the images in Administration cockpit in Products/Image area.
Also the images are not displayed at our shop during runtime.

Investigations:
1) allow_url_fopen = on (in a root folder of our site in php.ini)
2) Import/Export was implemented via <<Export/Import Tool (V3.9) for Ocstore 2.x>>
3) the mentioned remote URLs can be successfully open in a browser

I fully understand that ocstore engine is using DIR_IMAGE which is defined as the next
define('DIR_IMAGE', '/home/my_shop/workspace/sites/my_shop.com/image/');

Is there any way to force ocstore engine in some cases (because I also have a set of images in <<my_shop.com/image/>> and I want them to be displayed fine too) to use remote URLs as they are
OR
is the any way to solve my problem? What is a standard solution for this issue?

Newbie

Posts

Joined
Fri Oct 12, 2018 4:51 am

Post by straightlight » Sun Oct 14, 2018 7:47 pm

ISSUE: Import was successful. However, I do not see the images in Administration cockpit in Products/Image area.
Also the images are not displayed at our shop during runtime.
The images were imported but the relative paths from the database in your product and product image database tables may be invalid while the image filenames may still exist on your file server. A simple query may need to be used to update those paths. However, it may have to be ran multiple times since you claim to handle more than 10000 products.

In addition, since you are using an extension, contact the extension developer to solve this issue with your image paths.

The most generated errors being found on Opencart forum originates from contributed programming. The increased counters are caused by posted redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by IP_CAM » Mon Oct 15, 2018 6:39 am

Well, the good old OC standard way, to HTTP(S) - link images, would be,
to define HTTP(S):// image Links, in one or both of your config.php Files,
like:

Code: Select all

// HTTP
define('HTTP_SERVER', 'http://www.ejacob.ch/cart/');
define('HTTP_IMAGE', 'http://ejacob.ch/cart/image/'); // SUBDOMAIN-LIKE Link
// HTTPS
define('HTTPS_SERVER', 'http://www.ejacob.ch/cart/');
define('HTTPS_IMAGE', 'http://ejacob.ch/cart/image/'); // SUBDOMAIN-LIKE Link
and in the catalog/model/tool/image.php file, change the internal PATH linking,
from:

Code: Select all

if (isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1'))) {
	return $this->config->get('config_ssl') . 'image/' . $new_image;
	} else {
	return $this->config->get('config_url') . 'image/' . $new_image;
}
to HTTP(S) linking:

Code: Select all

if (isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1'))) {
// return $this->config->get('config_ssl') . 'image/' . $new_image;  // OLD CODE
	return HTTPS_IMAGE . $new_image;
	} else {
// return $this->config->get('config_url') . 'image/' . $new_image;  // OLD CODE
	return HTTP_IMAGE . $new_image;
}
to make images be called by HTTP(S). The advantage of this is, that Images
can be linked, to make it look, for Site Performance Tests, like a cookiefree
SubDomain Linking, which adds remarkably to overall Performance Results.

And there are other OC Files, where such Lines exist, depending on the OC Version
( and Extensions/Themes ! ) used, containing this:

Code: Select all

$this->config->get('config_url') . 'image/'
$this->config->get('config_ssl') . 'image/'
you just have to seach for those Lines, to find out, in which files that Code exists, to also
change them, either by use of a VqMod (or OcMod), or then directly in the Source File itself.
I added a VqMod, to let you see, how such can be solved as well, by OcMod or VqMod.

It's one of those things, working the same in all OC Version from 1.5.6.x UP, where it no longer
was default part of it. The ONLY Difference might be, that the $new_image Variable
might be named $image_new in your Version OC, so check on this first !

But since Images can only be managed by ADMIN, if they are linked, to be accessable by
Admin, meaning, that they have to reside on the same Server, this way at least. And for
Admins, it might be easier, to leave the Admin config-linking the default Image-PATH Way,
since this has no influence on the final front side 'output'-Link !

And for 'real' externally hosted Images, some Extensions exist, as I recall,
like:
https://www.opencart.com/index.php?rout ... n_id=32885
https://www.opencart.com/index.php?rout ... n_id=26681

Good Luck! ;)
Ernie

PS: The VqMod also add's the otherwise still MISSING image width + height TAG's.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<modification>
<id><![CDATA[HTTP_IMAGE + HTTPS_IMAGE Links and Sizes]]></id>
<version><![CDATA[OS v.1.5.6.5]]></version>
<vqmver><![CDATA[2.4.1]]></vqmver>
<author><![CDATA[Ernie - IP_CAM]]></author>
<file name="catalog/model/tool/image.php">
<operation error="skip">
<search position="replace"><![CDATA[return $this->config->get('config_ssl') . 'image/' . $new_image;]]></search>
<add><![CDATA[return HTTPS_IMAGE . $new_image . '" width="' . $width . '" height="' . $height;]]></add>
</operation>            
    
<operation error="skip">
<search position="replace"><![CDATA[return $this->config->get('config_url') . 'image/' . $new_image;]]></search>
<add><![CDATA[return HTTP_IMAGE . $new_image . '" width="' . $width . '" height="' . $height;]]></add>
</operation>                  
</file>

<file name="catalog/controller/payment/skrill.php,catalog/controller/total/voucher.php,catalog/model/checkout/order.php,catalog/model/tool/image.php" error="skip">
<operation error="skip">
<search position="replace"><![CDATA[$this->config->get('config_url') . 'image/']]></search>
<add><![CDATA[HTTP_IMAGE]]></add>
</operation>
<operation error="skip">
<search position="replace"><![CDATA[$this->config->get('config_ssl') . 'image/']]></search>
<add><![CDATA[HTTPS_IMAGE]]></add>
</operation>
</file>
</modification>

For Sale: Top URL's, including an OpenCart V-Pro Shop!
A wide range of matching Designs can be seen here: http://www.opencart.li
For Information on URL's offered, please contact me at: jti@jacob.ch
Hundreds of Mods in 380+ Repositories for OC v.1.5.x - v.2.3.x
to be found on my Github Site: https://github.com/IP-CAM
Image


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: No registered users and 4 guests