Skip to content

Instantly share code, notes, and snippets.

@dpdexter
Created October 21, 2011 03:01
Show Gist options
  • Save dpdexter/1303003 to your computer and use it in GitHub Desktop.
Save dpdexter/1303003 to your computer and use it in GitHub Desktop.
BR price_html error [#0000125]
function _check_product_price($p)
{
$group_id = $this->EE->session->userdata["group_id"];
// Deal with our price matrix
foreach($p["price_matrix"] as $price){
if( $price["group_id"] == 0 ||
$price["group_id"] == $group_id){
$amt = array(
'on_sale' => FALSE,
'label' => $price["price"],
'base' => $price["price"],
'price' => $price["price"],
'price_html' => '<p class="price">'.$this->_config["currency_marker"].$price["price"].'</p>'
);
}
}
foreach($p["sale_matrix"] as $sale){
$valid = 1;
$start = date("U",strtotime($sale["start_dt"]));
$end = date("U",strtotime($sale["end_dt"]));
if(time() < $start){
$valid = 0;
}
if($end != 0 && time() > $end){
$valid = 0;
}
if(($valid == 1) && ($sale["group_id"] == 0 || $sale["group_id"] == $group_id) && ($amt["price"] > $sale["price"]))
{
$amt = array(
'on_sale' => TRUE,
'base' => $amt["price"],
'label' => $sale["price"],
'price' => $sale["price"],
'price_html' => '<p class="price"><span class="original">'.$this->_config["currency_marker"].$amt["price"].'</span><span class="sale">'.$this->_config["currency_marker"].$sale["price"].'</span></p>',
'sale_price' => $sale["price"]
);
}
}
return $amt;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment