Jump to content

[1.7] How to show discount for client groups


mr.b1ngo

Recommended Posts

Hi!

 

 

Does anyone know how to show a discount value when I'm setting it for client groups?

 

For example how to edit ProductPresenter.php to show flags:

 private function addFlags(
        array $presentedProduct,
        ProductPresentationSettings $settings,
        array $product
    ) {
        $flags = array();

        $show_price = $this->shouldShowPrice($settings, $product);

        if ($show_price && $product['online_only']) {
            $flags['online-only'] = array(
                'type' => 'online-only',
                'label' => $this->translator->trans('Online only', array(), 'Shop.Theme.Catalog'),
            );
        }

        if ($show_price && $product['on_sale'] && !$settings->catalog_mode)  {
            $flags['on-sale'] = array(
                'type' => 'on-sale',
                'label' => $this->translator->trans('On sale!', array(), 'Shop.Theme.Catalog'),
            );
        }

        if ($show_price && $product['reduction'] && !$settings->catalog_mode && !$product['on_sale']) {
            $flags['discount'] = array(
                'type' => 'discount',
                'label' => $this->translator->trans('Reduced price', array(), 'Shop.Theme.Catalog'),
            );
        }

        if ($product['new']) {
            $flags['new'] = array(
                'type' => 'new',
                'label' => $this->translator->trans('New', array(), 'Shop.Theme.Catalog'),
            );
        }

        if ($product['pack']) {
            $flags['pack'] = array(
                'type' => 'pack',
                'label' => $this->translator->trans('Pack', array(), 'Shop.Theme.Catalog'),
            );
        }

        $presentedProduct['flags'] = $flags;

        return $presentedProduct;
    }

Let's modify nw:

if ($show_price && $product['reduction'] && !$settings->catalog_mode && !$product['on_sale']) {
            $flags['discount'] = array(
                'type' => 'discount',
                'label' => $this->translator->trans('Reduced price', array(), 'Shop.Theme.Catalog'),

$product['reduction'] - here we could write discount from client group... but I don't know the variable name....

Same situation with: 'type' => 'discount' - can I replace it with client group doscount?

 

 

Link to comment
Share on other sites

Someone? Something?

 

After changing prduct-presenter.tpl to this (removed 'if'):

{if $product.show_price}
  <div class="product-prices">
    {block name='product_discount'}
      {*if $product.has_discount*}
        <div class="product-discount">
          {hook h='displayProductPriceBlock' product=$product type="old_price"}
          <span class="regular-price">{$product.regular_price}</span>
        </div>
      {*/if*}
    {/block}

Result:

 

563,20 zł
563,20 zł netto

692,74 brutto

 

So there is:

Discounted price 

Discounted price

Discounted price with tax

 

Crossed out should be regular price without tax.

Changing {$product.regular_price} to other variables shows nothing.

 

Trying to change things in ProductPresenter.php but no luck :(

 

Best regards!

 

Edited by mr.b1ngo (see edit history)
Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...