Product Code (EAN) Attribute Products if empty

07.11.2022 12:09
#1
spike77
Joomshopping forum user no avatar
Name: Manfred
30.04.2015
Posts: 706
Quote
Product Code (EAN) Attribute Products if empty

If the article number remains empty for a product attribute, the article number of the main product is displayed.

Expample
ID Main Produkt: 11111
Attribute Produkt 1: 11111
Attribute Product 2: (empty)

If select attribute Product 2, ID from Main Product (11111) is displayed. That´s not good and not correct.

How can I hide to show Articlenumbers if Attribute EAN-Field is empty?


Last change: 07.11.2022 12:27
 
07.11.2022 20:14
#2
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 25941
Quote
Aw: Product Code (EAN) Attribute Products if empty

/components/com_jshopping/js/functions.js

if (json.ean){
jQuery("#product_code").html(json.ean);
}
if (json.manufacturer_code){
jQuery("#manufacturer_code").html(json.manufacturer_code);
}


change to

if (typeof json.ean !== 'undefined'){
jQuery("#product_code").html(json.ean);
}
if (typeof json.manufacturer_code !== 'undefined'){
jQuery("#manufacturer_code").html(json.manufacturer_code);
}

 
07.11.2022 20:21
#3
spike77
Joomshopping forum user no avatar
Name: Manfred
30.04.2015
Posts: 706
Quote
Aw: Product Code (EAN) Attribute Products if empty

Thanks! Works, but it is possible to disable the description in front of the EAN too? "Artikelnummer:" " if EAN it´s empty.


Last change: 07.11.2022 20:22
 
08.11.2022 20:27
#4
spike77
Joomshopping forum user no avatar
Name: Manfred
30.04.2015
Posts: 706
Quote
Aw: Product Code (EAN) Attribute Products if empty

if the text cannot be hidden, a display of "not available" would also be conceivable.

Hope for help. Thanks in advance.

 
09.11.2022 22:14
#5
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 25941
Quote
Aw: Product Code (EAN) Attribute Products if empty

if (typeof json.ean !== 'undefined'){
jQuery("#product_code").html(json.ean);
if (json.ean == '') {
jQuery(".jshop_code_prod").hide();
} else {
jQuery(".jshop_code_prod").show();
}
}

 
09.11.2022 22:37
#6
spike77
Joomshopping forum user no avatar
Name: Manfred
30.04.2015
Posts: 706
Quote
Aw: Product Code (EAN) Attribute Products if empty

Works, thank you so much!

 
29.11.2022 08:46
#7
spike77
Joomshopping forum user no avatar
Name: Manfred
30.04.2015
Posts: 706
Quote
Aw: Product Code (EAN) Attribute Products if empty

I see your solution work only for disable description "EAN:" with Attribute Products.

If there is no Attribute, only the Main Product and EAN Field on Product Info Page is empty, description "EAN:" is still displayed.

Is there a solution for this too, if there is no EAN-Number on Product Info Page (Backend) deposited?

Thanks in Advance.


Last change: 29.11.2022 08:52
 
03.12.2022 08:24
#8
spike77
Joomshopping forum user no avatar
Name: Manfred
30.04.2015
Posts: 706
Quote
Aw: Product Code (EAN) Attribute Products if empty

is there a solution?

 
03.12.2022 17:18
#9
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 25941
Quote
Aw: Product Code (EAN) Attribute Products if empty

Change code template

<span class="jshop_code_prod">(<?php print JText::_('JSHOP_EAN')?>: <span id="product_code"><?php print $this->product->getEan();?></span>)</span><?php }?>

to

<span class="jshop_code_prod" <?php if (!$this->product->getEan()) {?>style="display: none"<?php }?> >(<?php print JText::_('JSHOP_EAN')?>: <span id="product_code"><?php print $this->product->getEan();?></span>)</span><?php }?>

 
03.12.2022 17:45
#10
spike77
Joomshopping forum user no avatar
Name: Manfred
30.04.2015
Posts: 706
Quote
Aw: Product Code (EAN) Attribute Products if empty

That´s it. Thank you very much!

 


Copyrights MAXXmarketing GmbH. Alle Rechte vorbehalten
Durch die Nutzung dieser Website stimme ich zu, dass Cookies zur optimalen Gestaltung der Website sowie zur Analyse der Nutzung der Website verwendet werden. Weiterführende Informationen finden Sie hier. OK, einverstanden.