Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

what could this be? php question

Featured Replies

apprently this:

 

<?php // put this php code at the very top of your page, before anything else gets displayed.
if(!session_id())session_start(); 
$cart_products = isset($_SESSION['_simpleshop_cart_products']) ? $_SESSION['_simpleshop_cart_products'] : array();
$cart_sub_total = 0;
$cart_total = 0;
$cart_shipping = 0;
foreach($cart_products as $product_id ?> $product){
       $quantity = max(1,(int)$product['quantity']);
       $product_total = $product['price'] * $quantity;
       $cart_sub_total += $product_total;
       if(isset($product['product_settings']['shipping']) && $product['product_settings']['shipping']>0){
               $cart_shipping += $product['product_settings']['shipping'];
       }
}
$cart_total = $cart_sub_total + $cart_shipping;
?>

 

then placing this code below will show the cart total of the php shopping system im using.

echo $cart_total;

 

however if you copy and paste the top into a text editor the author has made a big mistake on line 7 i think, reckon you know how to amend this line, to make it work?

The author might also of meant it to be

foreach($cart_products as product_id => $product)

 

The ?> is saying stop executing PHP

foreach($cart_products as $product_id => $product){

 

?

  • Author

The author might also of meant it to be

foreach($cart_products as product_id => $product)

The ?> is saying stop executing PHP

 

Thanks for pointing that out

 

foreach($cart_products as $product_id => $product){ ?

 

Threw me an error :(

 

Looks like line 7 should read:

foreach($cart_products as $product){

i.e. remove the '$product_id ?>'

 

Actually works wehey! cheers

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.