Topic: print default-price beside price for other
hi,
i have different shopper_groups with differents prices for products.
i want to print the default-price beside the special price for this shopper if he
You are not logged in. Please login or register.
hi,
i have different shopper_groups with differents prices for products.
i want to print the default-price beside the special price for this shopper if he
Just include this function in your ihtml file or add it to ps_product and call it accordingly:
function print_default_price($product_id){
global $vendor_id;
$q = "SELECT shopper_group_id FROM shopper_vendor_xref WHERE ";
$q .= "user_id='";
$q .= $auth["user_id"] . "' AND vendor_id='$vendor_id'";
$db->query($q);
$db->next_record();
$shopper_group_id = $db->f("shopper_group_id");
// Get the default shopper group id for this product and user
$q = "SELECT * FROM shopper_group WHERE ";
$q .= "vendor_id='$vendor_id' AND ";
$q .= "shopper_group_name='-default-'";
$db->query($q);
$db->next_record();
$default_shopper_group_id = $db->f("shopper_group_id");
if ($shopper_group_id != $default_shopper_group_id ){
$q = "SELECT * from product_price WHERE product_id='$product_id' AND ";
$q .= "shopper_group_id='$shopper_group_id'";
$db->query($q);
if ($db->next_record()) {
echo $db->f("product_price");
return true;
}
}
}//function
This should only print a default price if the shopper is not a default shopper
That's exactly what I was looking for.
I wish all the good stuff in this forum was all rolled up and squeezed into a nice new shiny version 1.0 of phpShop!
Thanks