2

I am having some trouble tweaking my template the way I want it. I am editing price.phtml and this base/regular/retail(WHATEVER) price is driving me nuts. When we have an item that has custom options it still shows the retail price. See below.
enter image description here

What I have done so far is, if you are logged in as wholesale, make everything either say Starting at: or Wholesale Each Price. I have turned off the retail price for other product types but this one is tied to other things. It is used for simple product with no wholesale pricing and it is used by a lot of things if you are not logged in.

What I would like to see is just the Starting at: Price. How can I hide this price on this product type from wholesale customers.

2 Answers 2

1

Using the code below I finally got everything working.

The code here checks if the customer is not wholesale. Then checks if the product has options. Then checks if Category or Product page because the same code is used in both spots.

This code seems to work for me I haven't found any issues with it yet:

<?php /** Start Modified Code **/?>


<?php /** Check if NOT LOGGED IN **/?>

<?php if(!Mage::getSingleton('customer/session')->isLoggedIn()){  ?>
<span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
                    <?php if ($_finalPrice == $_price): ?>
                        <?php echo $_coreHelper->formatPrice($_price, true) ?>
                    <?php else: ?>
                        <?php echo $_coreHelper->formatPrice($_finalPrice, true) ?>
                    <?php endif; ?>
                </span>
    <?php  }else{   ?>
    <span class="label"></span>
    <?php } ?>

<?php /** Check if LOGGED IN and CUSTOMER GROUP **/?>    

     <?php
        $login = Mage::getSingleton( 'customer/session' )->isLoggedIn(); //Check if User is Logged In
            if($login)
        {
            $groupId = Mage::getSingleton('customer/session')->getCustomerGroupId(); //Get Customers Group ID
            if($groupId != 2) //My wholesale customer id was 2 So I checked for 2. You can check according to your requirement
            {  ?>

<?php /** NOT WHOLESALE **/?>

                <span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
                    <?php if ($_finalPrice == $_price): ?>
                        <?php echo $_coreHelper->formatPrice($_price, true) ?>
                    <?php else: ?>
                        <?php echo $_coreHelper->formatPrice($_finalPrice, true) ?>
                    <?php endif; ?>
                </span>


    <?php  }else{   ?>


<?php /** WHOLESALE **/?>

<?php
/**
  *
  * Checks if Simple Product with Options
  *
  */
?>
                <?php if ( $_product->getData('has_options') && ($_product->getTypeID() == 'simple') ): ?>

<?php
/**
  * If Has Options
  * Checks if Category or Product Page
  * If Cat Page Don't put Base Price
  *
  */
?>
                    <?php 
                        $fullActionName = Mage::app()->getFrontController()->getAction()->getFullActionName();
                        if ($fullActionName == 'catalog_category_view') { ?>
                            <span class="label"></span>
<?php
 /**
   * Still If Has Options
   * If Prod Page Display Base Price
   *
   */
?>
                    <?php } elseif ($fullActionName == 'catalog_product_view') { ?>
                            <span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
                                <?php if ($_finalPrice == $_price): ?>
                                    <?php echo $_coreHelper->formatPrice($_price, true) ?>
                                <?php else: ?>
                                    <?php echo $_coreHelper->formatPrice($_finalPrice, true) ?>
                                <?php endif; ?>
                            </span>
                    <?php } ?>
<?php
 /**
   * If Doesn't Have Options
   * Display Base Price
   *
   */
?>                  
                <?php else: ?>
                    <span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
                        <?php if ($_finalPrice == $_price): ?>
                            <?php echo $_coreHelper->formatPrice($_price, true) ?>
                        <?php else: ?>
                            <?php echo $_coreHelper->formatPrice($_finalPrice, true) ?>
                        <?php endif; ?>
                    </span>
                <?php endif; ?>

    <?php } ?>
    <?php } ?>

<?php /** End Modified Code **/?>
0

Assign product price as customer groups after that use this code on list or view page, you will see product different price on both side same and equal to admin price. adjust code in your way.

<?php  $groupId = Mage::getSingleton('customer/session')->getCustomerGroupId();

 if($groupId ==1 || $groupId ==""){?>

              <?php if($product->getSpecialPrice()){?>

             <?php echo "$".$rprice = number_format($product->getPrice(),2); ?> </div>

              <?php }else{?>

              <?php  $product->setCustomerGroupId($groupId); 

           echo "$".$price = number_format($product->getPriceModel()->getFinalPrice(1, $product),2); ?>

              <?php } ?>

            </div>

            <?php if($product->getSpecialPrice()){ echo "Special Price $".number_format($product->getSpecialPrice(),2);?>

            <?php } ?>

            <?php }else{echo "$".$price = number_format($product->getPriceModel()->getFinalPrice(1, $product),2); }

 ?>
1
  • I guess I don't know as much as I thought about this. I assumed you meant to place this code in place in price.phtml in place of this code <span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> <?php if ($_finalPrice == $_price): ?> <?php echo $_coreHelper->formatPrice($_price, true) ?> <?php else: ?> <?php echo $_coreHelper->formatPrice($_finalPrice, true) ?> <?php endif; ?> </span>
    – jrl2222
    Commented Jan 4, 2017 at 15:06

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.