- Posts: 21
- Thank you received: 3
Product sku replaced by another sku
- marcob@polarisitalia.com
-
Topic Author
- Offline
Less
More
8 years 6 months ago #291451
by marcob@polarisitalia.com
Product sku replaced by another sku was created by marcob@polarisitalia.com
-- url of the page with the problem -- :
www.egimotors.it
-- HikaShop version -- : 3.4
-- Joomla version -- : 3.8.6
-- PHP version -- : 7
Hi, in my eshop i have many products SKU replaced by another SKU, for example:
product "belt hd sku 255" replace by "belt hd sku 266" can i redirect automatically from 255 to 266?
thanks in advance
-- HikaShop version -- : 3.4
-- Joomla version -- : 3.8.6
-- PHP version -- : 7
Hi, in my eshop i have many products SKU replaced by another SKU, for example:
product "belt hd sku 255" replace by "belt hd sku 266" can i redirect automatically from 255 to 266?
thanks in advance
Please Log in or Create an account to join the conversation.
Less
More
- Posts: 12953
- Thank you received: 1778
8 years 6 months ago #291465
by Mohamed Thelji
Replied by Mohamed Thelji on topic Product sku replaced by another sku
Hello,
Can you give us more information about how you created and configured your products through some screenshots for example so that we can have a better understanding of your issue ?
Thank you.
Can you give us more information about how you created and configured your products through some screenshots for example so that we can have a better understanding of your issue ?
Thank you.
Please Log in or Create an account to join the conversation.
- marcob@polarisitalia.com
-
Topic Author
- Offline
Less
More
- Posts: 21
- Thank you received: 3
8 years 6 months ago #291524
by marcob@polarisitalia.com
Replied by marcob@polarisitalia.com on topic Product sku replaced by another sku
thank you for your answer... look the example image you can see the old Sku 0450578 and the new SKU 0450251 if I search in my hikashop 0450578 I want to link in the description a link to 0450251.
Is it's possible put a link "these code is old, click here for the right code/sku 0450251"
image missing http://www.egimotors.it/images/hikashop.jpg
Is it's possible put a link "these code is old, click here for the right code/sku 0450251"
image missing http://www.egimotors.it/images/hikashop.jpg
Please Log in or Create an account to join the conversation.
Less
More
- Posts: 12953
- Thank you received: 1778
8 years 6 months ago #291525
by Mohamed Thelji
Replied by Mohamed Thelji on topic Product sku replaced by another sku
Hello,
Your issue is probably coming from the fact that the SKU number that you are trying to apply to your product is already taken by another product so when creating that product Hikashop will either alter the SKU number or tell you that it's already applied to another product.
You should probably change these SKU number directly one by one.
Sure, you can eventually add it through your product description.
Your issue is probably coming from the fact that the SKU number that you are trying to apply to your product is already taken by another product so when creating that product Hikashop will either alter the SKU number or tell you that it's already applied to another product.
You should probably change these SKU number directly one by one.
Is it's possible put a link "these code is old, click here for the right code/sku 0450251"
Sure, you can eventually add it through your product description.
Please Log in or Create an account to join the conversation.
- marcob@polarisitalia.com
-
Topic Author
- Offline
Less
More
- Posts: 21
- Thank you received: 3
8 years 6 months ago - 8 years 6 months ago #291601
by marcob@polarisitalia.com
Replied by marcob@polarisitalia.com on topic Product sku replaced by another sku
Thank you for anwser,
now I was able to print the correct code on the screen. I miss the last step build the link with the code that I print. how can i build hikashop url? thank you
i put my code in the file listin_table.php
www.egimotors.it/hika2.jpg
now I was able to print the correct code on the screen. I miss the last step build the link with the code that I print. how can i build hikashop url? thank you
i put my code in the file listin_table.php
Code:
<?php
$a = $this->row->product_name;
$code = substr($a, 14); // 2016
if (preg_match('/SOSTITUITO DA/',$a))
echo "$code";
?>
Last edit: 8 years 6 months ago by marcob@polarisitalia.com.
Please Log in or Create an account to join the conversation.
8 years 6 months ago #291610
by nicolas
Replied by nicolas on topic Product sku replaced by another sku
Hi,
The URL is available in the variable $link
So you can just do like that:
The URL is available in the variable $link
So you can just do like that:
Code:
echo '<a href="'.$link.'">'.$code.'</a>';
Please Log in or Create an account to join the conversation.
- marcob@polarisitalia.com
-
Topic Author
- Offline
Less
More
- Posts: 21
- Thank you received: 3
8 years 6 months ago - 8 years 6 months ago #291654
by marcob@polarisitalia.com
Replied by marcob@polarisitalia.com on topic Product sku replaced by another sku
Hi Nicolas, thank you for your answer.
I would like to link the code product insert of the product name, now i have these php code:
and the product name is "SOSTITUITO DA 0450249 ", how can I get the product_id of the code 0450249?
thanks in advance
Marco
I would like to link the code product insert of the product name, now i have these php code:
Code:
<?php
$a = $this->row->product_name;
$code = substr($a, 14); // 2016
if (preg_match('/SOSTITUITO DA/',$a))
//echo "$code";
$idsku = $this->row->product_id;
echo "$idsku";
$hikaurl = "<a href=\"http://www.egimotors.it/index.php?option=com_hikashop&ctrl=product&task=show&cid=$idsku\">Vedi codice</a>";
echo "$hikaurl";
?>
and the product name is "SOSTITUITO DA 0450249 ", how can I get the product_id of the code 0450249?
thanks in advance
Marco
Last edit: 8 years 6 months ago by marcob@polarisitalia.com.
Please Log in or Create an account to join the conversation.
Less
More
- Posts: 12953
- Thank you received: 1778
8 years 6 months ago - 8 years 6 months ago #291670
by Mohamed Thelji
Replied by Mohamed Thelji on topic Product sku replaced by another sku
Hello,
To do that, you'll ether have to manually search it through your back-end product listing or to use an SQL request through your code if your want it to be dynamic. Something like that:
docs.joomla.org/Selecting_data_using_JDatabase
Best regards,
Mohamed Thelji.
To do that, you'll ether have to manually search it through your back-end product listing or to use an SQL request through your code if your want it to be dynamic. Something like that:
Code:
$db = JFactory::getDBO();
$db->setQuery('SELECT product_id FROM #__hikashop_product WHERE product_code='.$db->Quote($code));
$id = $db->loadResult();
Best regards,
Mohamed Thelji.
Last edit: 8 years 6 months ago by nicolas.
Please Log in or Create an account to join the conversation.
- marcob@polarisitalia.com
-
Topic Author
- Offline
Less
More
- Posts: 21
- Thank you received: 3
8 years 6 months ago #291943
by marcob@polarisitalia.com
Replied by marcob@polarisitalia.com on topic Product sku replaced by another sku
Hi, good sounds your ideas about the query, i put these code:
and now i have that i want.
Thank you, very much
Regards
Code:
<?php
$a = $this->row->product_name;//inizializzo la varibile $a
$code = substr($a, 14); // selezione il codice dalla variabile $a
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select all records from the user profile table where key begins with "custom.".
// Order it by the ordering field.
$query->select($db->quoteName(array('product_id')));
$query->from($db->quoteName('#_hikashop_product'));
$query->where($db->quoteName('product_code') . ' = '. $db->quote($code));
// Reset the query using our newly populated query object.
$db->setQuery($query);
// Load the results as a list of stdClass objects (see later for more options on retrieving data).
$results = $db->loadAssoc();
$id= $results['product_id'];
if (preg_match('/SOSTITUITO DA/',$a))//stampo il link solo se $a contiene sostituito da
$hikaurl = "<a target=\"_blank\" href=\"http://www.egimotors.it/index.php?option=com_hikashop&ctrl=product&task=show&cid=$id\" id=\"btn-1524838088074\" class=\"sppb-btn sppb-btn-danger sppb-btn-xs sppb-btn-rounded\"><i class=\"fa fa-angle-double-right\"></i> Vedi codice corretto</a>";
echo "$hikaurl";
?>
Thank you, very much
Regards
Please Log in or Create an account to join the conversation.
Time to create page: 5.102 seconds