Image paths

Permalink Browser Info Environment
Hi
Is there any way to export the image path for each product, not sure what the best method is for this please.

Thanks

Type: Pre-Sale
Status: In Progress
Responsive
View Replies:
jero replied on at Permalink Reply
jero
No - the addon doesn't do anything with images since they're not something that you can update with a text file.
nikkor replied on at Permalink Reply
nikkor
The below is a bit of a hack to accomplish the export. I did not need to import, so I have not looked into that side of the process. It is pretty easy to export the images urls, if you update the file packages\jero_stock\models\stock.php. I only needed to get the fullsize and thumbnail but if you wanted to get the other associated images you can follow the same process.

In the download function: (public function download() { )
1) Add images fields such as ThumbnailURL & FullImageURL to the header:
$header = 'Name,ID,ThumbnailURL,FullImageURL,Qty,Status,Price,Special,Tiered,Login,Min,Weight,Units,RequiresTax,Tier1,Price1,Tier2,Price2,Tier3,Price3,Tier4,Price4,Tier5,Price5,Tier6,Price6,Tier7,Price7,Tier8,Price8,Tier9,Price9,Tier10,Price10';


2) Add the fields prThumbnailImageFID and prFullImageFID to the sql query:
$sql = 'select productID,prName,prThumbnailImageFID,prFullImageFID,prQuantity,prStatus,prPrice,prSpecialPrice,prUseTieredPricing,prRequiresLoginToPurchase,prMinimumPurchaseQuantity,prWeight,prWeightUnits,prRequiresTax from CoreCommerceProducts';


3) In the foreach loop that processes the SQL query, add in the the section marked /* Get fullpath to images */ and then the lines to insert the urls into the csv $row['prThumbnailImageFID'] . ',' . and $row['prFullImageFID'] . ',' .:
foreach ($data as $row) {
       if ($row['prUseTieredPricing'] == 1) {
      $row['prPrice'] = '';
       }
/* Get fullpath to images */  
       if ($row['prThumbnailImageFID'] == 0) {
            $row['prThumbnailImageFID'] = '';
       } else {
         $TNf = File::getByID($row['prThumbnailImageFID']);
           $TNfv = $TNf->getApprovedVersion();
           $row['prThumbnailImageFID'] = BASE_URL . $TNfv->getRelativePath();
         }
         if ($row['prFullImageFID'] == 0) {
            $row['prFullImageFID'] = '';
       } else {


Hope this helps someone else.

concrete5 Environment Information

# concrete5 Version
5.6.3.1

# concrete5 Packages
eCommerce (2.8.11).

# concrete5 Overrides
blocks/product, blocks/autonav, blocks/page_list, blocks/elements, blocks/logos, blocks/form, blocks/bin_product, blocks/product_list, languages/fa_IR, languages/el_GR, languages/it_IT, languages/es_MX, languages/zh_CN, languages/cs_CZ, languages/nl_NL, languages/pt_PT, languages/ru_RU, languages/de_DE, languages/ja_JP, languages/zh_TW, languages/tr_TR, languages/es_PE, languages/fr_FR, languages/he_IL, languages/es_ES, languages/ar, languages/sk_SK, languages/vi_VN, languages/fi_FI, languages/es_AR, languages/ro_RO, languages/da_DK, languages/sv_SE, languages/nb_NO, languages/sl_SI, themes/template, tools/page_controls_menu_js.php

# concrete5 Cache Settings
Block Cache - On
Overrides Cache - On
Full Page Caching - Off

# Server Software
Apache

# Server API
cgi-fcgi

# PHP Version
5.3.29

# PHP Extensions
bcmath, bz2, bz2_filter, calendar, cgi-fcgi, Core, ctype, curl, date, dba, dom, enchant, ereg, exif, fileinfo, filter, ftp, gd, gettext, hash, http, iconv, imap, intl, ionCube Loader, json, ldap, libxml, mailparse, mbstring, mcrypt, memcache, mhash, mysql, mysqli, openssl, pcntl, pcre, PDO, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, pspell, readline, Reflection, session, shmop, SimpleXML, soap, sockets, SourceGuardian, SPL, SQLite, sqlite3, standard, stats, tidy, tokenizer, wddx, xattr, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend Guard Loader, zip, zlib.

# PHP Settings
max_execution_time - 120
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 120
max_input_vars - 2000
memory_limit - 192M
post_max_size - 100M
safe_mode - Off
safe_mode_exec_dir - <i>no value</i>
safe_mode_gid - Off
safe_mode_include_dir - <i>no value</i>
sql.safe_mode - Off
upload_max_filesize - 100M
http.persistent.handles.limit - -1
ldap.max_links - Unlimited
memcache.max_failover_attempts - 20
mysql.max_links - 60
mysql.max_persistent - Unlimited
mysqli.max_links - 60
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
pgsql.max_links - 60
pgsql.max_persistent - Unlimited
session.cache_limiter - nocache
session.gc_maxlifetime - 7200
soap.wsdl_cache_limit - 5
safe_mode_allowed_env_vars - PHP_
safe_mode_protected_env_vars - LD_LIBRARY_PATH

Browser User-Agent String

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.