Forums / Setting Up Categories, Products, Attributes / Can Attribute Show Certain Words on $0 Attributes?

Can Attribute Show Certain Words on $0 Attributes?

Views: 931

Results 1 to 3 of 3
2 Apr 2015, 5:27 PM
#1
panzc2020 avatar

panzc2020

New Zenner

Join Date:
May 2014
Posts:
68
Plugin Contributions:
0

Can Attribute Show Certain Words on $0 Attributes?

Zen Cart Version 1.5.1

I am not sure if this going to be simple or more complicated.
What I wanted to do is to have attributes that have $0 to show certain wording.

I wanted attributes to look similar to eMed Hospital Beds site.
http://www.emedhospitalbeds.com/invacare-semi-electric-hospital-bed-set/?utm_source=nextag&utm_medium=cse&utm_term=561

Currently, this is how attributes look...

http://homepromedical.com/cart/beds-bed-accessories-c-9/hospital-beds-c-9_29/semielectric-hospital-beds-c-9_29_36/invacare-semielectric-hospital-bed-p-65.html

No Bed Rails
Invacare Reduced Gap Full-length Bed Rail [6629]
Invacare Reduced Gap Half-Length Bed Rail [6630]

However, I **do **wanted to be like...

No Bed Rails
Invacare Reduced Gap Full-length Bed Rail [6629] COLOR="#008000"[/COLOR]
Invacare Reduced Gap Half-Length Bed Rail [6630] COLOR="#008000"[/COLOR]

However, I **do not **really want to be like...

No Bed Rails COLOR="#FF0000"[/COLOR]
Invacare Reduced Gap Full-length Bed Rail [6629] (FREE!)
Invacare Reduced Gap Half-Length Bed Rail [6630] (FREE!)

I don't want the word "FREE!" showing up on attribute that add no accessories at all.

I'm not sure how complicated to set that up. I don't think I can do that via admin panel.

Sincerely, PanZC2020 (April 2nd, 2015)

3 Apr 2015, 5:10 AM
#2
bn17311 avatar

bn17311

Zen Follower

Join Date:
Apr 2010
Posts:
319
Plugin Contributions:
0

Re: Can Attribute Show Certain Words on $0 Attributes?

to get you going until a better solution comes along

in includes/modules/attributes.php

// normal price

                        if ($new_attributes_price == 0) {

                          $products_options_display_price= '';

                        } else {

                          $products_options_display_price= ATTRIBUTES_PRICE_DELIMITER_PREFIX . $products_options->fields['price_prefix'] .

                          $currencies->display_price($new_attributes_price, zen_get_tax_rate($product_info->fields['products_tax_class_id'])) . ATTRIBUTES_PRICE_DELIMITER_SUFFIX;

                        }

                      }

                    }

change line to

                          $products_options_display_price= ' (Free !)';

bryan

3 Apr 2015, 10:03 PM
#3
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Can Attribute Show Certain Words on $0 Attributes?

Where YOUR_TEMPLATE is the name of your active template...

Realize that the below solution (provided by bn17311) will apply " (Free!)" to ALL attributes that have a zero price, not just those of any specific category, product, etc...

bn17311:

to get you going until a better solution comes along

in includes/modules/YOUR_TEMPLATE/attributes.php

// normal price

                    if ($new_attributes_price == 0) {

                      $products_options_display_price= '';

                    } else {

                      $products_options_display_price= ATTRIBUTES_PRICE_DELIMITER_PREFIX . $products_options->fields['price_prefix'] .

                      $currencies->display_price($new_attributes_price, zen_get_tax_rate($product_info->fields['products_tax_class_id'])) . ATTRIBUTES_PRICE_DELIMITER_SUFFIX;

                    }

                  }

                }
> 
> change line to
> 
> ```php
                          $products_options_display_price= ' (Free !)';

bryan

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...