lafi-business-group / lafi-sa.issues

Issue only repo for public. Please report all issues of lafi-sa.com in this repo
https://www.lafi-sa.com
0 stars 0 forks source link

[Special Offer] Wrong Text Shown On Non-Clickable Button #11

Closed azharakbar closed 4 years ago

azharakbar commented 4 years ago

Describe the bug When an item that has special offer goes out of stock, then the Buy Now button should be disabled, and its text should be "Sold Out" But the text change happens only specialOffer page, but not in items, search, itemDetail pages

To Reproduce Steps to reproduce the behavior:

  1. Create an offer on an item
  2. Update the stock to 0
  3. Go to special offer page, the button will be dark red with Text "Sold Out"
  4. Now search the product [OR] go to items page, [OR] go to itemDetail page
  5. You will find that the button is Red and disabled, but the text is not "Sold Out"

Expected behavior An offer item that is out of stock should be RED, DISABLED, and carry SOLD OUT on the button image

Screenshots If applicable, add screenshots to help explain your problem.

  1. Search page image
  2. Items page image
  3. Item Details page image
azharakbar commented 4 years ago

Issue reproduced locally

azharakbar commented 4 years ago

RCA The button text was decided upon multiple factors and all these were enclosed in nested ternary operators

Simple Ternary Operation x = y ? z : a

Complex Ternary Operation x = y ? z : a ? b : c

The situation was complex, and since parenthesis was not provided, it evaluated to wrong value

Fix x = y ? z : (a ? b : c)

azharakbar commented 4 years ago
  1. Search Page image

  2. Items Page image

  3. Item Detail Page image