Skip to content

Commit

Permalink
- fix error when no rate is available for product on amazon
Browse files Browse the repository at this point in the history
- fix amazon products don't submit due to change in ratings format
  • Loading branch information
Cybrarist committed Jan 15, 2025
1 parent 23c129b commit c9f053e
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Product.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class Product {
favourite: document.getElementById("favourite").checked,
stock_available: document.getElementById("stock_available").checked,
lowest_within: document.getElementById("lowest_within").value,
number_of_rates:this.number_of_rates,
number_of_rates:this.number_of_rates ?? 0,
price:this?.price ?? 0,
})
})
Expand Down
1 change: 0 additions & 1 deletion Stores/Amazon.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class Amazon extends Product {
.replaceAll("(" , "")
.replaceAll(")" , "")

console.log(this.number_of_rates)

}

Expand Down
3 changes: 2 additions & 1 deletion Stores/Argos.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ if (window.location.href.includes('argos.co.uk') ){
)
setTimeout(() => {


if (!data)
return;
insert_chart_into_dom(data.series)

var stores_elements=document.getElementById("all_stores_cards");
Expand Down
5 changes: 2 additions & 3 deletions Stores/Ebay.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ if (window.location.href.includes('ebay.') ){
async get_product_data() {

super.get_product_data().then(data => {


console.log(data)
if (!data)
return;

insert_chart_into_dom(data.series)
//add highest and lowest prices
Expand Down
5 changes: 4 additions & 1 deletion Stores/Noon.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ class Noon extends Product {

super.get_product_data().then(data => {
//
insert_chart_into_dom(data.series)
if (!data)
return;

insert_chart_into_dom(data.series)
//add highest and lowest prices
document.querySelector(".priceNow[data-qa='div-price-now']").insertAdjacentHTML("beforebegin" ,
`<div class="lowest_price" > Lowest Price ${data.prices[data.current_store_id].lowest_price.toLocaleString()}</div>
Expand Down
8 changes: 1 addition & 7 deletions functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ function insert_chart_into_dom(series){

function get_global_form(){

console.log(product)

return` <div class="form_background">
<div class="form_field">
<label> Product Name </label>
Expand Down Expand Up @@ -137,11 +135,7 @@ function get_global_form(){
</div>
<button id="submit_discount_form"> Save </button>
</div>
`



}
`}



Expand Down

0 comments on commit c9f053e

Please sign in to comment.