[Skip to main content](#vessel-content)

#   New plugin based on Hikashop Google Products Plugin

##

- **[marchela-apostolova](/forum/user/58393-marchela-apostolova "View marchela-apostolova's Profile")**
- [![marchela-apostolova's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/58393-marchela-apostolova "View marchela-apostolova's Profile") Topic Author
- [ Offline](/forum/user/58393-marchela-apostolova)

Less More

- Posts: 14
- Thank you received: 1
-
-

7 years 5 months ago -  7 years 5 months ago [\#307047](#307047) by [marchela-apostolova](/forum/user/58393-marchela-apostolova "View marchela-apostolova's Profile")  *[New plugin based on Hikashop Google Products Plugin](/forum/37-import-export-csv-xls/897562-new-plugin-based-on-hikashop-google-products-plugin#307047 "Hello,  I'm working on new plugin based on Hikashop Google Products Plugin that exports the products from multilingual website with Falang according to the used Content Languages ID.  I am using the following code for the name of the product:  In result, I always get the translation of the name of 1 product, that repeats for all of them.  Can you assist me with the solution?  Best regards,  Mihail")* was created by *[marchela-apostolova](/forum/user/58393-marchela-apostolova "View marchela-apostolova's Profile")*

Hello,

I'm working on new plugin based on Hikashop Google Products Plugin that exports the products from multilingual website with Falang according to the used Content Languages ID.

I am using the following code for the name of the product: Code:

if($plugin-&gt;params['fb_lang_id'] == 0){ $xml .= "\t".'&lt;g:title&gt;&lt;![CDATA[ '.$product-&gt;product_name.' ]]&gt;&lt;/g:title&gt;'."\n"; } else { $published = "\n AND published=1"; $query = "SELECT language_id, reference_id, reference_table, reference_field, value" . "\n FROM #__falang_content" . "\n WHERE language_id=".$plugin-&gt;params['fb_lang_id'] . $published . "\n AND reference_field='product_name'" ; $db-&gt;setQuery( $query ); $products = $db-&gt;loadObjectList(); $ids = array(); foreach($products as $key =&gt; $row) { $ids[] = (int)$row-&gt;reference_id; } $xml .= "\t".'&lt;g:title&gt;&lt;![CDATA[ '.$row-&gt;value.' ]]&gt;&lt;/g:title&gt;'."\n"; }

In result, I always get the translation of the name of 1 product, that repeats for all of them.

Can you assist me with the solution?

Best regards,

Mihail

Last edit: 7 years 5 months ago by [nicolas](/forum/user/63-nicolas "View nicolas's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM3LWltcG9ydC1leHBvcnQtY3N2LXhscy84OTc1NjItbmV3LXBsdWdpbi1iYXNlZC1vbi1oaWthc2hvcC1nb29nbGUtcHJvZHVjdHMtcGx1Z2luP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86541
- Thank you received: 14304
-
-

7 years 5 months ago [\#307050](#307050) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[New plugin based on Hikashop Google Products Plugin](/forum/37-import-export-csv-xls/897562-new-plugin-based-on-hikashop-google-products-plugin#307050 "Hello,  I'm working on new plugin based on Hikashop Google Products Plugin that exports the products from multilingual website with Falang according to the used Content Languages ID.  I am using the following code for the name of the product:  In result, I always get the translation of the name of 1 product, that repeats for all of them.  Can you assist me with the solution?  Best regards,  Mihail")*

Hi,

That piece of code displays the product name of the current product being processed.
So first, you should add a condition to that MySQL query to retrieve on the entry matching the id of the current product as you don't need the entries of the other products. Then, you should do a loadObject instead of a loadObjectList since you should always get only one entry. And also, you check if $row-&gt;value is empty, because if it is, you still want to use the product_name of the main product object.
Also, your use of $row-&gt;value is after/outside the foreach which initialize $row for each loop. So in such case, $row contains the last element of the array.
Finally, ideally, you should move your MySQL query before the foreach on the products to load all the product_name entries in falang_content of all the products and replace product_name with "value" if value is found for the product and thus leave the code Code:

$xml .= "\t".'&lt;g:title&gt;&lt;![CDATA[ '.$product-&gt;product_name.' ]]&gt;&lt;/g:title&gt;'."\n";

"as is".
That way, you would reduce tremendously the resources necessary as it would only need one MySQL query instead of 1 per product.
On a XML with thousands of products, that will be critical.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM3LWltcG9ydC1leHBvcnQtY3N2LXhscy84OTc1NjItbmV3LXBsdWdpbi1iYXNlZC1vbi1oaWthc2hvcC1nb29nbGUtcHJvZHVjdHMtcGx1Z2luP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[marchela-apostolova](/forum/user/58393-marchela-apostolova "View marchela-apostolova's Profile")**
- [![marchela-apostolova's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/58393-marchela-apostolova "View marchela-apostolova's Profile") Topic Author
- [ Offline](/forum/user/58393-marchela-apostolova)

Less More

- Posts: 14
- Thank you received: 1
-
-

7 years 4 months ago [\#307852](#307852) by [marchela-apostolova](/forum/user/58393-marchela-apostolova "View marchela-apostolova's Profile")  Replied by *[marchela-apostolova](/forum/user/58393-marchela-apostolova "View marchela-apostolova's Profile")* on topic *[New plugin based on Hikashop Google Products Plugin](/forum/37-import-export-csv-xls/897562-new-plugin-based-on-hikashop-google-products-plugin#307852 "Hello,  I'm working on new plugin based on Hikashop Google Products Plugin that exports the products from multilingual website with Falang according to the used Content Languages ID.  I am using the following code for the name of the product:  In result, I always get the translation of the name of 1 product, that repeats for all of them.  Can you assist me with the solution?  Best regards,  Mihail")*

Thank you for your help, Nicolas.

Following your advice I moved MySQL request before foreach of the products and I replaced product_name with value.

Here is the code: Code:

$query = 'SELECT * FROM '.hikashop_table('product').' WHERE product_access=\'all\' AND product_published=1 AND product_type=\'main\''; if(!empty($plugin-&gt;params['fb-in_stock_only'])){ $query .= ' AND product_quantity!=0'; } $db-&gt;setQuery($query); $products = $db-&gt;loadObjectList(); if(empty($products)){ return true; } //========================================= $queryNametr = "SELECT a.*" . "\n FROM #__falang_content a" . "\n INNER JOIN amkal_hikashop_product b " . "\n ON a.reference_id = b.product_id " . "\n WHERE language_id=".$plugin-&gt;params['fb_lang_id'] . "\n AND published=1" . "\n AND reference_field = 'product_name'" //. "\n AND reference_field = 'product_description'" ; $db-&gt;setQuery($queryNametr); $products = $db-&gt;loadObjectList(); //================================================== */ $ids = array(); foreach($products as $key =&gt; $row){ $ids[] = (int)$row-&gt;product_id; if($plugin-&gt;params['fb_lang_id'] == 0){ $products[$key]-&gt;alias = JFilterOutput::stringURLSafe($row-&gt;product_name); } else { $products[$key]-&gt;alias = JFilterOutput::stringURLSafe($row-&gt;value); } }

In this case I receive the following SQL syntax error:
1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') AND a.category_published=1 AND a.category_type='product' AND b.category_id!=2 ' at line 1

If I upload the request before

$query = 'SELECT * FROM '.hikashop_table('product').' WHERE product_access=\'all\' AND product_published=1 AND product_type=\'main\'';

[CDATA[ '.$product-&gt;product_name.' ]] - the main language remains.

In order to test MySQL request, I return it back to its previous place and then naturally I receive all the translations names in &lt;item&gt; &lt;/item&gt;

Here is the code:
Code:

$db-&gt;setQuery($queryNametr); $products = $db-&gt;loadObjectList(); $ids = array(); foreach($products as $key =&gt; $row){ $ids[] = (int)$row-&gt;reference_id; $products[$key]-&gt;alias = JFilterOutput::stringURLSafe($row-&gt;value); $xml .= "\t".'&lt;2g:title&gt;&lt;![CDATA[ '.$row-&gt;value.' ]]&gt;&lt;/2g:title&gt;'."\n"; }

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM3LWltcG9ydC1leHBvcnQtY3N2LXhscy84OTc1NjItbmV3LXBsdWdpbi1iYXNlZC1vbi1oaWthc2hvcC1nb29nbGUtcHJvZHVjdHMtcGx1Z2luP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86541
- Thank you received: 14304
-
-

7 years 4 months ago [\#307854](#307854) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[New plugin based on Hikashop Google Products Plugin](/forum/37-import-export-csv-xls/897562-new-plugin-based-on-hikashop-google-products-plugin#307854 "Hello,  I'm working on new plugin based on Hikashop Google Products Plugin that exports the products from multilingual website with Falang according to the used Content Languages ID.  I am using the following code for the name of the product:  In result, I always get the translation of the name of 1 product, that repeats for all of them.  Can you assist me with the solution?  Best regards,  Mihail")*

Hi,

Your MySQL query is not correct. You have only a.* in the select. So only the columns from falang_content are loaded.
But the columns from hikashop_product are not loaded.
You should replace a.* by * in order to load both the data from Falang and the data from HikaShop in $products.
The MySQL error you get is because in some other piece of the code, it does a MySQL query to get the categories and it assume that each entry in $products has a product_id which isn't the case as you don't load the data from hikashop_product.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM3LWltcG9ydC1leHBvcnQtY3N2LXhscy84OTc1NjItbmV3LXBsdWdpbi1iYXNlZC1vbi1oaWthc2hvcC1nb29nbGUtcHJvZHVjdHMtcGx1Z2luP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[marchela-apostolova](/forum/user/58393-marchela-apostolova "View marchela-apostolova's Profile")**
- [![marchela-apostolova's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/58393-marchela-apostolova "View marchela-apostolova's Profile") Topic Author
- [ Offline](/forum/user/58393-marchela-apostolova)

Less More

- Posts: 14
- Thank you received: 1
-
-

7 years 4 months ago [\#307899](#307899) by [marchela-apostolova](/forum/user/58393-marchela-apostolova "View marchela-apostolova's Profile")  Replied by *[marchela-apostolova](/forum/user/58393-marchela-apostolova "View marchela-apostolova's Profile")* on topic *[New plugin based on Hikashop Google Products Plugin](/forum/37-import-export-csv-xls/897562-new-plugin-based-on-hikashop-google-products-plugin#307899 "Hello,  I'm working on new plugin based on Hikashop Google Products Plugin that exports the products from multilingual website with Falang according to the used Content Languages ID.  I am using the following code for the name of the product:  In result, I always get the translation of the name of 1 product, that repeats for all of them.  Can you assist me with the solution?  Best regards,  Mihail")*

Thank you, Nicolas.

I corrected the request and the error is gone, but:

[CDATA[ '.$product-&gt;product_name.' ]] - is still on the main language.

The translation is in [CDATA[ '.$row-&gt;value.' ]] but again with the name of the last product only.

$products[$key]-&gt;alias = JFilterOutput::stringURLSafe($row-&gt;value); is in foreach of the products.

I changed the code to:
$ids[] = (int)$row-&gt;reference_id;
Code:

$ids = array(); foreach($products as $key =&gt; $row){ if($plugin-&gt;params['fb_lang_id'] == 0){ $ids[] = (int)$row-&gt;product_id; $products[$key]-&gt;alias = JFilterOutput::stringURLSafe($row-&gt;product_name); } else { $ids[] = (int)$row-&gt;reference_id; $products[$key]-&gt;alias = JFilterOutput::stringURLSafe($row-&gt;value); } }

But the result is still the same.

Best regards,

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM3LWltcG9ydC1leHBvcnQtY3N2LXhscy84OTc1NjItbmV3LXBsdWdpbi1iYXNlZC1vbi1oaWthc2hvcC1nb29nbGUtcHJvZHVjdHMtcGx1Z2luP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86541
- Thank you received: 14304
-
-

7 years 4 months ago [\#307903](#307903) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[New plugin based on Hikashop Google Products Plugin](/forum/37-import-export-csv-xls/897562-new-plugin-based-on-hikashop-google-products-plugin#307903 "Hello,  I'm working on new plugin based on Hikashop Google Products Plugin that exports the products from multilingual website with Falang according to the used Content Languages ID.  I am using the following code for the name of the product:  In result, I always get the translation of the name of 1 product, that repeats for all of them.  Can you assist me with the solution?  Best regards,  Mihail")*

Hi,

The fact that with this MySQL query, you still have the product_name with the main name and not the translated one is normal since there is no mechanism in your code to copy the text from $row-&gt;value to $row-&gt;product_name when $row-&gt;value is not empty.
I think that's what you're missing.
I don't see how $row-&gt;value could only have the value of the last product. That's only possible if you display it outside of the foreach, after it when the PHP looped through the array and the variable $row is left with the last element on which it looped.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM3LWltcG9ydC1leHBvcnQtY3N2LXhscy84OTc1NjItbmV3LXBsdWdpbi1iYXNlZC1vbi1oaWthc2hvcC1nb29nbGUtcHJvZHVjdHMtcGx1Z2luP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[marchela-apostolova](/forum/user/58393-marchela-apostolova "View marchela-apostolova's Profile")**
- [![marchela-apostolova's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/58393-marchela-apostolova "View marchela-apostolova's Profile") Topic Author
- [ Offline](/forum/user/58393-marchela-apostolova)

Less More

- Posts: 14
- Thank you received: 1
-
-

7 years 4 months ago [\#307925](#307925) by [marchela-apostolova](/forum/user/58393-marchela-apostolova "View marchela-apostolova's Profile")  Replied by *[marchela-apostolova](/forum/user/58393-marchela-apostolova "View marchela-apostolova's Profile")* on topic *[New plugin based on Hikashop Google Products Plugin](/forum/37-import-export-csv-xls/897562-new-plugin-based-on-hikashop-google-products-plugin#307925 "Hello,  I'm working on new plugin based on Hikashop Google Products Plugin that exports the products from multilingual website with Falang according to the used Content Languages ID.  I am using the following code for the name of the product:  In result, I always get the translation of the name of 1 product, that repeats for all of them.  Can you assist me with the solution?  Best regards,  Mihail")*

Thank you, Nicolas.

I did not understand how to copy $row-&gt;value to $row-&gt;product_name

Can you help me with the code?

if(isset($row-&gt;value)) { ...

Best regards.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM3LWltcG9ydC1leHBvcnQtY3N2LXhscy84OTc1NjItbmV3LXBsdWdpbi1iYXNlZC1vbi1oaWthc2hvcC1nb29nbGUtcHJvZHVjdHMtcGx1Z2luP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86541
- Thank you received: 14304
-
-

7 years 4 months ago [\#307961](#307961) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[New plugin based on Hikashop Google Products Plugin](/forum/37-import-export-csv-xls/897562-new-plugin-based-on-hikashop-google-products-plugin#307961 "Hello,  I'm working on new plugin based on Hikashop Google Products Plugin that exports the products from multilingual website with Falang according to the used Content Languages ID.  I am using the following code for the name of the product:  In result, I always get the translation of the name of 1 product, that repeats for all of them.  Can you assist me with the solution?  Best regards,  Mihail")*

Hi,

You can do like that: Code:

foreach($products as $key =&gt; $row){ if(!empty($row-&gt;value)) $products[$key]-&gt;product_name = $row-&gt;value; }

The following user(s) said Thank You: [marchela-apostolova](/forum/user/58393-marchela-apostolova "View marchela-apostolova's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM3LWltcG9ydC1leHBvcnQtY3N2LXhscy84OTc1NjItbmV3LXBsdWdpbi1iYXNlZC1vbi1oaWthc2hvcC1nb29nbGUtcHJvZHVjdHMtcGx1Z2luP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[marchela-apostolova](/forum/user/58393-marchela-apostolova "View marchela-apostolova's Profile")**
- [![marchela-apostolova's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/58393-marchela-apostolova "View marchela-apostolova's Profile") Topic Author
- [ Offline](/forum/user/58393-marchela-apostolova)

Less More

- Posts: 14
- Thank you received: 1
-
-

7 years 4 months ago [\#308010](#308010) by [marchela-apostolova](/forum/user/58393-marchela-apostolova "View marchela-apostolova's Profile")  Replied by *[marchela-apostolova](/forum/user/58393-marchela-apostolova "View marchela-apostolova's Profile")* on topic *[New plugin based on Hikashop Google Products Plugin](/forum/37-import-export-csv-xls/897562-new-plugin-based-on-hikashop-google-products-plugin#308010 "Hello,  I'm working on new plugin based on Hikashop Google Products Plugin that exports the products from multilingual website with Falang according to the used Content Languages ID.  I am using the following code for the name of the product:  In result, I always get the translation of the name of 1 product, that repeats for all of them.  Can you assist me with the solution?  Best regards,  Mihail")*

Thank you, Nicolas.

The translations of the names are great with this code.

I tried to translate the same way the description of the products, using new sql request AND reference_field = 'product_description'.

Now it seems that only the description is translated and the name remains on the main language. Here is the code:
Code:

$query = 'SELECT * FROM '.hikashop_table('product').' WHERE product_access=\'all\' AND product_published=1 AND product_type=\'main\''; if(!empty($plugin-&gt;params['fb-in_stock_only'])){ $query .= ' AND product_quantity!=0'; } $db-&gt;setQuery($query); $products = $db-&gt;loadObjectList(); if(empty($products)){ return true; } //name $queryNametr ========================== if($plugin-&gt;params['fb_lang_id'] &gt; 0){ $queryNametr = "SELECT *" . "\n FROM #__falang_content a" . "\n INNER JOIN #__hikashop_product b " . "\n ON a.reference_id = b.product_id " . "\n WHERE language_id=".$plugin-&gt;params['fb_lang_id'] . "\n AND published=1" . "\n AND product_published=1" . "\n AND reference_field = 'product_name'" ; if(!empty($plugin-&gt;params['fb-in_stock_only'])){ $queryNametr .= ' AND product_quantity!=0'; } $db-&gt;setQuery($queryNametr); $products = $db-&gt;loadObjectList(); } //========================================== */ $ids = array(); foreach($products as $key =&gt; $row){ if($plugin-&gt;params['fb_lang_id'] == 0){ $ids[] = (int)$row-&gt;product_id; $products[$key]-&gt;alias = JFilterOutput::stringURLSafe($row-&gt;product_name); } else { $ids[] = (int)$row-&gt;reference_id; $products[$key]-&gt;alias = JFilterOutput::stringURLSafe($row-&gt;value); if(!empty($row-&gt;value)) $products[$key]-&gt;product_name = $row-&gt;value; } } //description $queryDestr =================== if($plugin-&gt;params['fb_lang_id'] &gt; 0){ $queryDestr = "SELECT *" . "\n FROM #__falang_content a" . "\n INNER JOIN #__hikashop_product b " . "\n ON a.reference_id = b.product_id " . "\n WHERE language_id=".$plugin-&gt;params['fb_lang_id'] . "\n AND published=1" . "\n AND product_published=1" . "\n AND reference_field = 'product_description'" ; $db-&gt;setQuery($queryDestr); $products = $db-&gt;loadObjectList(); foreach($products as $k =&gt; $row){ $products[$k]-&gt;product_description = $row-&gt;value; } } //======================================= */

Could you correct me again with the code?

Best regards!

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM3LWltcG9ydC1leHBvcnQtY3N2LXhscy84OTc1NjItbmV3LXBsdWdpbi1iYXNlZC1vbi1oaWthc2hvcC1nb29nbGUtcHJvZHVjdHMtcGx1Z2luP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86541
- Thank you received: 14304
-
-

7 years 4 months ago [\#308011](#308011) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[New plugin based on Hikashop Google Products Plugin](/forum/37-import-export-csv-xls/897562-new-plugin-based-on-hikashop-google-products-plugin#308011 "Hello,  I'm working on new plugin based on Hikashop Google Products Plugin that exports the products from multilingual website with Falang according to the used Content Languages ID.  I am using the following code for the name of the product:  In result, I always get the translation of the name of 1 product, that repeats for all of them.  Can you assist me with the solution?  Best regards,  Mihail")*

Hi,

You should change the variable name $products for the second code to $products2 and then copy the value from $products2 to $products with a double foreach on both arrays.
Something like that: Code:

foreach($products2 as $k2 =&gt; $p2) { foreach($products as $k =&gt; $p) { if($p-&gt;product_id==$p2-&gt;product_id) $products[$k]-&gt;product_description = $p2-&gt;value; } }

The following user(s) said Thank You: [marchela-apostolova](/forum/user/58393-marchela-apostolova "View marchela-apostolova's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM3LWltcG9ydC1leHBvcnQtY3N2LXhscy84OTc1NjItbmV3LXBsdWdpbi1iYXNlZC1vbi1oaWthc2hvcC1nb29nbGUtcHJvZHVjdHMtcGx1Z2luP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[marchela-apostolova](/forum/user/58393-marchela-apostolova "View marchela-apostolova's Profile")**
- [![marchela-apostolova's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/58393-marchela-apostolova "View marchela-apostolova's Profile") Topic Author
- [ Offline](/forum/user/58393-marchela-apostolova)

Less More

- Posts: 14
- Thank you received: 1
-
-

7 years 4 months ago [\#308076](#308076) by [marchela-apostolova](/forum/user/58393-marchela-apostolova "View marchela-apostolova's Profile")  Replied by *[marchela-apostolova](/forum/user/58393-marchela-apostolova "View marchela-apostolova's Profile")* on topic *[New plugin based on Hikashop Google Products Plugin](/forum/37-import-export-csv-xls/897562-new-plugin-based-on-hikashop-google-products-plugin#308076 "Hello,  I'm working on new plugin based on Hikashop Google Products Plugin that exports the products from multilingual website with Falang according to the used Content Languages ID.  I am using the following code for the name of the product:  In result, I always get the translation of the name of 1 product, that repeats for all of them.  Can you assist me with the solution?  Best regards,  Mihail")*

Thank you very much for your help, Nicolas!

The translation of the products works great.

Now the users can upload their catalogues in different languages, regarding their wishes.

Do you want me to send you this Plugin?

But I would like to add another function in Hikashop Facebook Products Plugin - most probably changing the currency from ID. This could be useful for online shop with more currencies.

I looked up the tab hikashop_config but I didn't find how main_currency is written and saved, where the option that defines the main_currency is saved?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM3LWltcG9ydC1leHBvcnQtY3N2LXhscy84OTc1NjItbmV3LXBsdWdpbi1iYXNlZC1vbi1oaWthc2hvcC1nb29nbGUtcHJvZHVjdHMtcGx1Z2luP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86541
- Thank you received: 14304
-
-

7 years 4 months ago [\#308077](#308077) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[New plugin based on Hikashop Google Products Plugin](/forum/37-import-export-csv-xls/897562-new-plugin-based-on-hikashop-google-products-plugin#308077 "Hello,  I'm working on new plugin based on Hikashop Google Products Plugin that exports the products from multilingual website with Falang according to the used Content Languages ID.  I am using the following code for the name of the product:  In result, I always get the translation of the name of 1 product, that repeats for all of them.  Can you assist me with the solution?  Best regards,  Mihail")*

Hi,

No but you can post it here. Someone else might be interested.

Regarding the main currency, it is stored in hikashop_config. The entry with it has the namekey "main_currency". Note however that what is stored is the currency_id of the currency as per the table hikashop_currency. So you would to "convert" the id into the currency_code if you need the currency_code.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM3LWltcG9ydC1leHBvcnQtY3N2LXhscy84OTc1NjItbmV3LXBsdWdpbi1iYXNlZC1vbi1oaWthc2hvcC1nb29nbGUtcHJvZHVjdHMtcGx1Z2luP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[marchela-apostolova](/forum/user/58393-marchela-apostolova "View marchela-apostolova's Profile")**
- [![marchela-apostolova's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/58393-marchela-apostolova "View marchela-apostolova's Profile") Topic Author
- [ Offline](/forum/user/58393-marchela-apostolova)

Less More

- Posts: 14
- Thank you received: 1
-
-

7 years 4 months ago [\#308257](#308257) by [marchela-apostolova](/forum/user/58393-marchela-apostolova "View marchela-apostolova's Profile")  Replied by *[marchela-apostolova](/forum/user/58393-marchela-apostolova "View marchela-apostolova's Profile")* on topic *[New plugin based on Hikashop Google Products Plugin](/forum/37-import-export-csv-xls/897562-new-plugin-based-on-hikashop-google-products-plugin#308257 "Hello,  I'm working on new plugin based on Hikashop Google Products Plugin that exports the products from multilingual website with Falang according to the used Content Languages ID.  I am using the following code for the name of the product:  In result, I always get the translation of the name of 1 product, that repeats for all of them.  Can you assist me with the solution?  Best regards,  Mihail")*

Special thanks to Nicolas for the co-operation!

I uploaded Facebook Products Pluging for HikaShop Business.

Its name is Facebook Products Plugin, because it was inspired by the possibility of uploading catalogues in Facebook from multilingual sites in Facebook pages or for dynamic ads.

I think it should work correctly for Google, but I haven't tested it.

It's a modification Google Products Plugin and has two extra options:

1.Possibility of catalogue translation according to the ID of the language (FaLang installed).

2. Possibility of changing the price of the products according to the ID of the currency.

Now you can upload your catalogue in language different from the main language and you can add currency different from the main one.  *This attachment is hidden for guests.
Please log in or register to see it.*

The following user(s) said Thank You: [nicolas](/forum/user/63-nicolas "View nicolas's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM3LWltcG9ydC1leHBvcnQtY3N2LXhscy84OTc1NjItbmV3LXBsdWdpbi1iYXNlZC1vbi1oaWthc2hvcC1nb29nbGUtcHJvZHVjdHMtcGx1Z2luP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.085 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
