Advertisement
drkskwlkr

Price Data Widget

May 24th, 2023 (edited)
1,033
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.04 KB | Source Code | 0 0
  1. <?php
  2.  
  3. $output  = '<!-- Begin product review widget code -->' ;
  4. $output .= '<div id="ndrsl-prod-646c3bda1796af356c6d134b" class="ndrsl-widget ndrsl-product-widget"' ;
  5.  
  6. // If currency sign is prepended, switch places of $price & $currency
  7. $price_arr      = explode(' ', $product['price']) ;
  8. $price          = $price_arr[0] ;
  9. $currency       = $price_arr[1] ;
  10. // If you want to use currency ISO code instead of currency sign, simply write $currency = 'USD' or whatever instead.
  11.  
  12. $output .= ' data-product-id="'          . $product_id . '"' ;
  13. $output .= ' data-product-name="'        . $product['name'] . '"' ;
  14. $output .= ' data-product-url="'         . $href . '"' ;
  15. $output .= ' data-product-image-url="'   . $product['thumb'] . '"' ;
  16. $output .= ' data-product-description="' . $product_detail['description'] . '"' ;
  17. $output .= ' data-product-price="'       . floatval($price) . '"' ;
  18. $output .= ' data-product-currency="'    . $currency . '"' ;
  19. $output .= '></div>' ;
  20. $output  = '<!-- End product review widget code -->' ;
  21.  
  22. echo $output ;
  23. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement