Forum

Thread tagged as: Problem, Error

Perch Shop product list and detail

Hi

Just started trying to get the perch shop beta working

so i have created a few products and can get them to display with

perch_shop_products();

I then tried to create a list and detail page by creating the url pattern

shop/products/[slug:product]

in the product page

i use

  <?php perch_shop_product(perch_get('product'));?>

        <?php
if (perch_get('product')) {

 // Detail mode

perch_shop_product(perch_get('product'), array(
      'template' => 'shop/products/product.html',
      'filter' => 'slug',
      'match' => 'eq',
      'value' => perch_get('s'),
      'count' => 1,
  )); 

} else {

  perch_shop_products(); 

}


?>

which works with a few issues

  1. there is no product image

2 when i click add to cart i get

Fatal error: Call to a member function get_prices() on a non-object

when i look at the product and select options i see an error

Warning: Invalid argument supplied for foreach() in D:\htdocs\gscmr\perch\core\lib\api\PerchAPI_Form.class.php on line 246

can you see what i am doing wrong

is there a way you could put a video or document on the process for perch and runway for perch shop.

or on perch chat can someone post how they have done it.

Regards,

Brett

Brett Warne

Brett Warne 0 points

  • 5 years ago

update i have also tried

 <?php perch_shop_product(perch_get('product'));?>

        <?php
if (perch_get('product')) {

 // Detail mode

perch_shop_product(perch_get('product'), array(
      'template' => 'shop/products/product.html',
      'filter' => 'slug',
      'match' => 'eq',
      'value' => perch_get('product'),
      'count' => 1,
  )); 

} else {

  perch_shop_products(); 

}


?>

Brett Warne said:

// Detail mode

perch_shop_product(perch_get('product'), array(
     'template' => 'shop/products/product.html',
     'filter' => 'slug',
     'match' => 'eq',
     'value' => perch_get('product'),
     'count' => 1,
 )); 

You can't filter the results of perch_shop_product() because your requesting the specific product already.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Which build are you using Brett?

Hi drew. I am not at work but I downloaded it from here v1.1

Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you been sharing that file publicly anywhere else, or just here?

Just here that's the link you sent me.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok. It'd be great if you could treat it confidentially in the future.

All you should need to list a product is:

perch_shop_product(perch_get('product'));

Do you have a home tax location configured?

Sorry will be more careful next time

Yes i have the home tax location box ticked,

Where in the process are you able to decide on how many items you choose.

Updating versions

Perch Shop 1.0 Perch Products 1.0 Perch Orders 1.0 Perch Members 1.4

error is once you try and add to the cart

atal error: Call to a member function get_prices() on a non-object in \perch\addons\apps\perch_shop\lib\PerchShop_Cart.class.php on line 407

Ok after a lot of testing it is defiantly the quantity, and the work flow i was using. if you reset the cart when you go into the shop page and then i was adding the cart using the form from the getting started page. if i just use the

  <?php perch_shop_cart();?>

i see the cart, the issue i have now is there is a button for the quantity but no number, if you click on the up or down part of the button and then choose update it will update the totals, is this by design or something i am doing wrong. surely you need to see the quantity of each item before checkout.

Regards,

Brett

Drew McLellan

Drew McLellan 2638 points
Perch Support

When you add something to the cart the value should be set to 1 initially.

What do you mean by resetting the cart?

Drew McLellan

Drew McLellan 2638 points
Perch Support

It's probably easier all round to discuss these issues in Slack rather than the forum - pop in there.