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
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 |
No - the addon doesn't do anything with images since they're not something that you can update with a text file.
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:
2) Add the fields prThumbnailImageFID and prFullImageFID to the sql query:
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'] . ',' .:
Hope this helps someone else.
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 {
Viewing 15 lines of 35 lines. View entire code block.
Hope this helps someone else.