View Single Post
  #356  
Old 08-13-2021, 11:48 AM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default Re: X-Cart reBOOT (reDUX) Template

QUICK TIP: If you want to publicly display how many customers bought the product, and the total amount of products sold...

DEMO

1) In /reboot/get_product_info.php

Before...
Code:
?>
Insert...
Code:
# Get amount of people who bought this product $users_bought_qry = db_query("SELECT COUNT(DISTINCT(userid)) AS total FROM $sql_tbl[order_details_stats] WHERE productid='$productid';"); $users_bought_result = db_fetch_array($users_bought_qry); $smarty->assign("buyers", $users_bought_result); # Get amount of products sold $product_sales_qry = db_query("SELECT SUM(sum_amount) AS total FROM $sql_tbl[order_details_stats] WHERE productid='$productid' GROUP BY productid"); $product_sales_result = db_fetch_array($product_sales_qry); $smarty->assign("sales", $product_sales_result);
2) In /skin/reboot/customer/main/product_header.tpl


Before...
Code:
{if $config.Reboot.reboot_product_added_modified_details eq "Y"}
Insert...

Code:
{if $buyers.total && $buyers.total gte "2"} <div class="col-12 col-md-auto mr-md-4 mt-3 mt-md-2">Buyers: <span class="badge badge-pill badge-dark float-right float-md-none">{$buyers.total}</span></div> {/if} {if $sales.total && $sales.total gte "2"} <div class="col-12 col-md-auto mr-md-4 mt-3 mt-md-2">Sales: <span class="badge badge-pill badge-dark float-right float-md-none">{$sales.total}</span></div> {/if}


Or, do something like...
Code:
{if ($buyers.total && $buyers.total gte "2") && ($sales.total && $sales.total gte "2")} {capture name=alert} <b>{$buyers.total}</b> people bought <b>{$sales.total}</b> of these! {/capture} {include file="customer/alert.tpl" content=$smarty.capture.alert close=true type="success" icon="check"} {/if}

Maybe useful if you have healthy sales
__________________
xcartmods.co.uk
Reply With Quote