Full Picture Path and Product Path in CSV Export

  • Posts: 6
  • Thank you received: 0
  • Hikamarket Multivendor Hikashop Business
7 years 6 months ago #249737

-- url of the page with the problem -- : www.ludibrium.ch
-- HikaShop version -- : 2.6.4
-- Joomla version -- : 3.6.2
-- PHP version -- : 5.6.25
-- Browser(s) name and version -- : Chrome 52

Hello everybody. I want to make an export of data . That with the CSV works very well , but I would need for the product and the image of the entire path . Is it somehow possible to set it so , so instead will vase.jpg then entered www.xxx.ch/pictures/vase.jpg .
I try to work with channable.com

I hope you understand the google translate . Roger

Please Log in or Create an account to join the conversation.

  • Posts: 81378
  • Thank you received: 13037
  • MODERATOR
7 years 6 months ago #249740

Hi,

You can edit the file "export" of the view "product" via the menu Display>Views and add the code:

foreach($product->images as $k => $v){
$product->images[$k] = 'http://www.xxx.ch/pictures/'.$product->images[$k];
}
after the line:
foreach($this->products as $product) {

The following user(s) said Thank You: rwymann

Please Log in or Create an account to join the conversation.

  • Posts: 6
  • Thank you received: 0
  • Hikamarket Multivendor Hikashop Business
7 years 6 months ago #249813

Hi Nicolas

This solution don`t work, but i see the problem.
I need this function in the mass action and i think this code is on another place.
Sorry for my fault and i hope you can help me. :-)
Ups, i take the www.xxx ..... as a placeholder, now i see this is a "grmmmpfh" site......
The real path i need is www.ludibrium.ch/images/com_hikashop/upload/ .........

Thanks

Roger

Last edit: 7 years 6 months ago by rwymann. Reason: correktur

Please Log in or Create an account to join the conversation.

  • Posts: 81378
  • Thank you received: 13037
  • MODERATOR
7 years 6 months ago #249814

Hi,

The modification was for the "export" button of the products listing.
For the export of the mass action system, it is indeed another modification necessary.
You'll have to add the code:

if($data=='product' && $table == 'images')
$element = 'http://www.xxx.ch/pictures/'.$element;
after the line:
foreach($array as $element){
in the file administrator/components/com_hikashop/classes/massaction.php

The following user(s) said Thank You: rwymann

Please Log in or Create an account to join the conversation.

  • Posts: 6
  • Thank you received: 0
  • Hikamarket Multivendor Hikashop Business
7 years 4 months ago #255948

Hi Nicolas
I give the csv file from mass action to "channable" to pass the products. Until now, I could make all adjustments with additional fields, but I can not get the manufacturer to get into the csv. I have the IDs in the export, but need the name of the manufacturer. Is there a possibility. Many many thanks. Roger

Please Log in or Create an account to join the conversation.

  • Posts: 81378
  • Thank you received: 13037
  • MODERATOR
7 years 4 months ago #255970

Hi,

There is no 1/2 line changes you can add to do that as you need to load the manufacturer data with a MySQL query and then replace the id by the name from the results to the products array in the _loadResults function of the administrator/components/com_hikashop/classes/massaction.php
It will require a developer to help you with that.

Please Log in or Create an account to join the conversation.

  • Posts: 44
  • Thank you received: 1
7 years 3 months ago #258415

Thank you, the above solution for a full URL for images in Mass Action works.

However, I still need the full URL to the product for Mass Actions. Can you tell me how to modify the mass action.php to achieve that?

PS: At the moment there is no value in that field

Thank you

Please Log in or Create an account to join the conversation.

  • Posts: 81378
  • Thank you received: 13037
  • MODERATOR
7 years 3 months ago #258447

Hi,

The problem is that when HikaShop/Joomla generates a product page URL, it uses the current menu item to get its alias, etc.
In the backend, when you process a mass action, or when it is triggered automatically, that information is not available.
And it's not possible for HikaShop/Joomla to guess which menu item you want to use for each product so even if it would pick one automatically or ask you to choose one, you might end up with different URLs than what you want if you have several menu items for your shop.

That's why the best way to do that if you want to is to have a canonical URL in your products (HikaShop can generate it automatically with the "Force canonical URLs on listings" setting of the HikaShop configuration), and to use such code :

if($data=='product' && $table == 'product_canonical')
$element = 'http://www.xxx.ch/'.$element;
like explained in www.hikashop.com/forum/import-export-csv...v-export.html#249814 to get the URL of each product in your massaction CSV.

The following user(s) said Thank You: rwymann

Please Log in or Create an account to join the conversation.

  • Posts: 44
  • Thank you received: 1
7 years 2 months ago #258525

Hello Nicolas

The data that is filled into the "product_url" field in mass action is actually the Brand URL not the Product URL.

I have added the code as you suggested and set the listings to generate the canonical url ...

???

Please Log in or Create an account to join the conversation.

  • Posts: 81378
  • Thank you received: 13037
  • MODERATOR
7 years 2 months ago #258527

Hi,

Yes, I know that the product_url contains the Brand URL.
As I said the Product URL isn't stored and I didn't talk about the "product_url" column at all, so I don't see why you bring it up.

If you have a canonical URL in your product and you've done the code modification as explained, then you'll get the product page URL in the product_canonical column of your exported CSV.

Please Log in or Create an account to join the conversation.

  • Posts: 44
  • Thank you received: 1
7 years 2 months ago #258560

Sorry, my mistake, I did not notice the product_canonical column.

Now I have all the entries in the field, however ...

1. the domain is missing in the front even though we add it in the call

if($data=='product' && $table == 'product_canonical')
$element = ' scarvesaustralia.com.au/'.$element ;

2. some of the entries do not start with '/' some do ....

Would you be able to help me further please? Thank you

Please Log in or Create an account to join the conversation.

  • Posts: 81378
  • Thank you received: 13037
  • MODERATOR
7 years 2 months ago #258562

Hi,

Hard to say without more details.
Please provide a screenshot of the settings of your mass action and a screenshot of the modification you did in the massaction.php file.

Please Log in or Create an account to join the conversation.

  • Posts: 44
  • Thank you received: 1
7 years 2 months ago #258613

Settings of Mass Action



Modifications in massaction.php


CSV file result


Thank you

Attachments:
The following user(s) said Thank You: rwymann

Please Log in or Create an account to join the conversation.

  • Posts: 81378
  • Thank you received: 13037
  • MODERATOR
7 years 2 months ago #258640

Hi,

Ok, I see now.
For the canonical URL, instead of that modification, add the code:
if($params->table=='product' && $column == 'product_canonical')
$element->$column = 'http://www.xxx.ch'.$element->$column;

before the line:
if(isset($element->$column) && ($key===$k1 || $key===$params->table) && is_string($this->displayByType($params->types,$element,$column))){

Please Log in or Create an account to join the conversation.

  • Posts: 44
  • Thank you received: 1
7 years 2 months ago #258645

Hello Nicholas

Happy New Year to you Nicholas!

That is it. It works now. Thank you.

However, one question. I set the trigger to HOURS but changes to the products are not reflected, meaning the data file is not written. Does this need a cron job to work?

I used AFTER CREATE PRODUCT, UPDATE PRODUCT ... it works but only exports the one product. I need all of them.

Please Log in or Create an account to join the conversation.

  • Posts: 81378
  • Thank you received: 13037
  • MODERATOR
7 years 2 months ago #258662

Hi,

Yes, you need to configure the cron if you want to use period triggers:
www.hikashop.com/support/documentation/5...ashop-cron-task.html

The following user(s) said Thank You: sarawhite

Please Log in or Create an account to join the conversation.

  • Posts: 44
  • Thank you received: 1
7 years 2 months ago #258687

Sweet, it works like a charm now.

Thank you

Please Log in or Create an account to join the conversation.

Time to create page: 0.110 seconds
Powered by Kunena Forum