Upgrading from Frozen

Open to all! Ask other shopowners for help.
Post Reply
puddlec
Member
Posts: 31
Joined: Mon Dec 07, 2020 3:11 pm
Phoenix Version:
Has thanked: 1 time
Been thanked: 7 times

Upgrading from Frozen

Post by puddlec »

possible looking to upgrade from frozen. running on php 7.1
made a huge amount of changes to get it to work the way we needed to.

most things look the same, so should be easy enough to convert (i hope)

the only major change i'm struggling with is the checkout

one of the key things is adding another box to the checkout_shipping to record the delivery date on selected products.
which works it out based on the products weight.
e.g. if the product weight is 1 then show a box showing a calendar
if its products weight is 2 then just show text saying delivery will be in x days

this is what i used to find what product has the height weight

Code: Select all

	  $products = $cart->get_products(); // get the basket contents
for ($i=0, $n=sizeof($products); $i<$n; $i++) { //loop through the basket contents
$test .= $products[$i]['weight']; // get the 'weight' of the product - radio buttons in admin save the days option as the weight so it can be used here	
} // end loop
$arr2 = str_split($test,4); // spilt the resulting info so it can be used below
$blah = max($arr2); // find the highest value so we can use it below

but getting a error
Fatal error: Uncaught Error: Cannot use object of type Product as array
the line in question is

Code: Select all

$test .= $products[$i]['weight']; 


Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
burt
Core Team
Posts: 4547
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Upgrading from Frozen

Post by burt »

Code: Select all

$products = $cart->get_products();
foreach ($products as $product) {
  echo $product->get('weight');
}
Does this Product object collect weight ?

To see a full Product object, to determine that;

Code: Select all

$products = $cart->get_products();
foreach ($products as $product) {
  echo '<pre>';
  print_r($product);
  echo '</pre>';
}
I am not here to build for you.
I am here to build with you. Let's help each other.
puddlec
Member
Posts: 31
Joined: Mon Dec 07, 2020 3:11 pm
Phoenix Version:
Has thanked: 1 time
Been thanked: 7 times

Re: Upgrading from Frozen

Post by puddlec »

thanks for that, got it working eventually,

just a few cases of me being an idiot, with removing the old code


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply