Advertisement
fordrm

Custom code - MarketPress special pricing

Apr 2nd, 2013
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.80 KB | None | 0 0
  1.  
  2.     if ($meta["mp_is_sale"]) {
  3.       //do some crazy stuff here to get the lowest price pair ordered by sale prices
  4.       asort($meta["mp_sale_price"], SORT_NUMERIC);
  5.       $lowest = array_slice($meta["mp_sale_price"], 0, 1, true);
  6.       $keys = array_keys($lowest);
  7.       $mp_price = $meta["mp_price"][$keys[0]];
  8.       $mp_sale_price = array_pop($lowest);
  9.             $price .= '<span itemprop="price" class="mp_current_price">'.$mp->format_currency('', $mp_price).'</span></span>';
  10.           } else {
  11.       sort($meta["mp_price"], SORT_NUMERIC);
  12.             $price = __('from', 'mp').' <span itemprop="price" class="mp_normal_price"><span class="mp_current_price">'.$mp->format_currency('', $meta["mp_price"][0]).'</span></span>';
  13.           }
  14.         } else {
  15.                 return '';
  16.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement