X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   Product Price Converted to Rewards Points VALUE (https://forum.x-cart.com/showthread.php?t=77911)

Blainevk 07-16-2020 08:45 PM

Product Price Converted to Rewards Points VALUE
 
Hello,

When I had an Xcart 4 (classic) Store, I had someone do a conversion for me where it would automatically convert the Price of the product into the quantity of Rewards Points needed to redeem for the same product, so the shopper could see BOTH Dollar Value & Rewards Points Value needed.

The conversion was:

{math|formatnumeric:',' equation="price * 1000 + 5" price = $product.price}

What needs to be changed in this conversion to work with Xcart 5 Multivendor?

ALSO:

How would the same conversion be added to this Xcart 5 Multivendor template:

<div class="product-price {{ this.getFingerprint() }}">
<ul class="product-price product-price-range">
<li class="product-price-base"><span class="price product-price min-of-range">{{ this.formatPrice(this.getMinListPrice(), this.null, 1)|raw }}</span></li>
<li class="product-price-base"><span class="price product-price range-delimiter">{{ this.getPriceRangeDelimiter() }}</span></li>
<li class="product-price-base"><span class="price product-price max-of-range">{{ this.formatPrice(this.getMaxListPrice(), this.null, 1)|raw }}</span></li>
</ul>
</div>

Thanks in advance for your help.

cflsystems 07-17-2020 04:05 AM

Re: Product Price Converted to Rewards Points VALUE
 
You will need custom module to do that and to modify the appropriate template to show the numbers.

You can do something like

{{ (this.getMinListPrice() * 1000) + 5 }}

which will do the math and place it in the template but it looks cumbersome


Code:

<div class="product-price {{ this.getFingerprint() }}">
  <ul class="product-price product-price-range">
    <li class="product-price-base"><span class="price  product-price min-of-range">{{  this.formatPrice(this.getMinListPrice(), this.null, 1)|raw  }}</span></li>
    <li class="product-price-base"><span class="price  product-price range-delimiter">{{ this.getPriceRangeDelimiter()  }}</span></li>
    <li class="product-price-base"><span class="price  product-price max-of-range">{{  this.formatPrice(this.getMaxListPrice(), this.null, 1)|raw  }}</span></li>
  </ul>



  <ul class="product-price product-price-range">
    <li class="product-price-base"><span class="price  product-price min-of-range">{{ (this.getMinListPrice() * 1000) + 5 }}</span></li>
    <li class="product-price-base"><span class="price  product-price range-delimiter">{{ this.getPriceRangeDelimiter()  }}</span></li>
    <li class="product-price-base"><span class="price  product-price max-of-range">{{ (this.getMaxListPrice() * 1000) + 5 }}</span></li>
  </ul>
</div>


Blainevk 07-18-2020 04:18 PM

Re: Product Price Converted to Rewards Points VALUE
 
Hi Steve,

Thanks so much for your help on this!

It took a little trial & error, but it worked exactly how i wanted it to! If you would like to see the finished product look here...

https://blainespartynetwork.net/partypoints/giftmall/

Here is the finished code that I used:

{##
# Price widget
#}
<br>
<div class="product-price {{ this.getFingerprint() }}">
<ul class="product-price product-price-range">
This item FREE with<br>
<li class="product-price-base"><span style="color: #bd0014; font-size: 24px;" class="price product-price min-of-range">{{ (this.getMinListPrice() * 1000) + 0 }}</span></li>
<li class="product-price-base"><span style="color: #bd0014; font-size: 24px;" class="price product-price range-delimiter">{{ this.getPriceRangeDelimiter() }}</span></li>
<li class="product-price-base"><span style="color: #bd0014; font-size: 24px;" class="price product-price max-of-range">{{ (this.getMaxListPrice() * 1000) + 0 }}&nbsp;<img src="http://blainespartynetwork.net/partypoints/giftmall/images/poker_chip_store.png" width="32px" alt="" /></span></li>
</ul>

or pay cash or use both!

<ul class="product-price product-price-range">
<li class="product-price-base"><span class="price product-price min-of-range">{{ this.formatPrice(this.getMinListPrice(), this.null, 1)|raw }}</span></li>
<li class="product-price-base"><span class="price product-price range-delimiter">{{ this.getPriceRangeDelimiter() }}</span></li>
<li class="product-price-base"><span class="price product-price max-of-range">{{ this.formatPrice(this.getMaxListPrice(), this.null, 1)|raw }}</span></li>
</ul>
</div>


Now, the only thing I need is for the code to place a "comma" at the thousand mark like it did in the old Xcart 4 version: {math|formatnumeric:',' equation="price * 1000 + 5" price = $product.price}... I'm assuming the "{math|formatnumeric:',' " in the code is what made that happen\, but I couldn't figure out how to that into the current Xcart version to make it work... Any ideas? Different code needed?

Thanks again & looking forward to your reply,
Blaine

cflsystems 07-19-2020 06:23 AM

Re: Product Price Converted to Rewards Points VALUE
 
The price format is something you can set from admin. Thousands delimiter, decimals delimiter, sign, zeros, etc. Look in the settings.


All times are GMT -8. The time now is 02:22 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.