Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8303215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:28:17+00:00 2026-06-08T17:28:17+00:00

We have an attribute code called web_availability to message different forms of product availability

  • 0

We have an attribute code called web_availability to message different forms of product availability to the customer – Example: Availability “80” should message “In Store Only” on a search result and/or a product detail page. Each of the availability values that we set up are automatically assigned an option value in magento as follows:

<input type="text" class="input-text required-option" value="80" name="option[value][532][0]">

I declared the variables as:

    <?php
$_shipping_messaging = $_product->getShippingMessaging(); //looks for a value of "0" or "1" to assign either Free Shipping, or Plus Shipping Messaging
$_shipping_price = $_product->getShippingPrice(); //if product is plus shipping this messages the approximate shipping price on the product

$web_avail_options = $_product->getResource()->getAttribute('web_availability')) {
foreach ($web_avail_options as $web_avail_option) {
    if ($web_avail_option['value'] == $_product->getData('web_availability')) {
        $web_availability = $web_avail_option['label'];
        }
  }
  ?>

Placed the following into magento’s price.phtml:

    <?php
  if ($shipping_messaging == 0) {
      echo '+ $' . number_format($_shipping_price, 2) . " Shipping"; // displays "+ $x.xx Shipping" on the product page
  } elseif ($_shipping_messaging == 1) {
      echo "Free Shipping"; // displays "Free Shipping" on the product page
  }
  else ($web_avail_option == '70' || '80' || '90'); {
      echo "In Store Only";
  }

  ?>

The shipping messaging (“Free Shipping”, or “+ $4.80 Shipping) appear as I would expect them to, however it ALWAYS displays the “In Store Only” message regardless of the product’s avilability. I have tried every conceivable combination of ==, <, >, as well as using different parts of the initial variable I declared at the beginning?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T17:28:18+00:00Added an answer on June 8, 2026 at 5:28 pm

    Please notice your code, especially the else statement.


    else ($web_avail_option == '70' || '80' || '90'); {
    echo "In Store Only";
    }

    The else statement is formatted wrong, please notice below code. Your else statement is checking if the web avail option is 70 but you’re not using an elseif and after the OR operator you’re checking 80. Well.. 80 is always true.

    A sulution: You may want to save the correct state in an array (example: $correct_status = array(70,80,90);. If these code are saved in an array, you can use below else statement.

    elseif(in_array($web_avail_option, $correct_status)) { echo "In store only"; }

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have inserted a code to display product attribute in view.phptml, which works fine.
I have a dropdown attribute called Housing (attribute code housing). I want to get
I have a line of code that counts all attribute names that end in
I have this code to identify two different image map shape attributes. What I'm
I have an attribute for my users called :last_request_at, :null => false I need
I am trying to get Magento to set product attribute values on store views
So, I have a custom attribute called CompressAttribute which is set up as a
I have written code for javascript but it is not called any how. I
Designing code to handle transfers of objects called contractBundles. Have this in the models.py
I have to store 2 million codes, being every code a string of fixed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.