0

I'm trying to get Custom Attribute by getAttributeText(), i've 3 store with 3 different url
So when i use that function, 2 of my store return "no", and 1 return "yes", i don't know how to fix this or any idea what is cause
Please help, thanks you guys :(

So here is how i set up in admin: enter image description here

As you can see, right now, i config it to "no", but 2 of my store working fine (return "no"), and another store is not working well (return "yes")

So here is the code:

..\Magento_Catalog\templates\product\view\addtocart.phtml

<?php $_product = $block->getProduct(); ?>
<?php $buttonTitle = __('Add to Cart'); ?>
<?php $dailydealhelper=$this->helper('Smartwave\Dailydeals\Helper\Data'); ?>
<?php if ($_product->isSaleable()): ?>
<div class="box-tocart">
    <?php if($block->getRequest()->getParam('dailydealproduct') || $dailydealhelper->isDealProduct($_product->getId())) : ?>
       <?php $productSku=$_product->getSku(); ?>
    <input type="text" id="todate" value="<?php echo $dailydealhelper->getDailydealToDate($productSku); ?>" style="display:none;" >
    <input type="text" style="display: none;" id="fromdate" value="<?php echo $dailydealhelper->getDailydealFromDate($productSku); ?>">
    <p id="countdown"></p>
    <div class="sw-dailydeal-wrapper">
      <div class="sw-dailydeal">
        <?php if($block->getRequest()->getParam('dailydealproduct')) :?>
            <p id="expired"></p> 
        <?php endif; ?>
        <div class="countdowncontainer" style="display:none;">
            <span class="dailydeal-label">
                <?php echo __('Offer Ends In:'); ?>
            </span>
            <span class="number-wrapper">
                <div class="line"></div>
                <span class="number day"><p id="countdown_days"></p></span>
                <div class="caption"><?php echo __('Days'); ?></div>
            </span>

            <span class="number-wrapper">
                <div class="line"></div>
                <span class="number hour"><p id="countdown_hours"></p></span>
                <div class="caption"><?php echo __('Hours'); ?></div>
            </span>

            <span class="number-wrapper">
                <div class="line"></div>
                <span class="number min"><p id="countdown_minutes"></p></span>
                <div class="caption"><?php echo __('Minutes'); ?></div>
            </span>

            <span class="number-wrapper">
                <div class="line"></div>
                <span class="number sec"><p id="countdown_seconds"></p></span>
                <div class="caption"><?php echo __('Seconds'); ?></div>
            </span>
        </div>
      </div>
    </div>
    <?php endif; ?>

    <?php 
    $is_saleable = $_product->getAttributeText('is_saleable');
    if ($is_saleable) {
      $is_saleable = trim($is_saleable," ");
      $is_saleable = strtolower($is_saleable);
    }

    $request_quote = $_product->getAttributeText('request_quote');
    if ($request_quote) {
      $request_quote = trim($request_quote," ");
      $request_quote = strtolower($request_quote);
    }
    var_dump($request_quote); exit;

Thanks for reading :)

1 Answer 1

1

As you said you are getting the correct values into two stores not only the last one.

maybe you are missed to set request_quote NO in your product

follow below screenshot. switch to every store and check your request_quote option value.

enter image description here

2
  • Oh man, you are so true, thanks you for this :) saved alot of time debugging, thanks you :)
    – fudu
    Commented Oct 20, 2018 at 11:10
  • Welcome, bro :)
    – Hitesh
    Commented Oct 20, 2018 at 11:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.