Forum
PHP Fatal Error
I'm having issues with my cart being a blank page when clicked add to cart. This is the error in the log:
PHP Fatal error: Call to a member function get_prices() on boolean in /home/linweb31/g/geoffready.web-design.wales/user/htdocs/admin/addons/apps/perch_shop/lib/PerchShop_Cart.class.php on line 723
Any help?
cart.html
<!-- breadcrumbs -->
<div class="breadcrumbs">
<div class="container">
<ol class="breadcrumb breadcrumb--ys pull-left">
<li class="home-link"><a href="index.php" class="icon icon-home"></a></li>
<li><a href="shop.php">Shop</a></li>
<li class="active">Cart</li>
</ol>
</div>
</div>
<!-- /breadcrumbs -->
<!-- CONTENT section -->
<div id="pageContent">
<div class="container">
<!-- title -->
<perch:if id="product_count" match="gt" value="0">
<perch:form id="cart" app="perch_shop">
<div class="title-box">
<h1 class="text-center text-uppercase title-under">YOUR CART (<perch:shop id="item_count" />)</h1>
</div>
<!-- /title -->
<!-- Shopping cart table -->
<div class="container-widget">
<table class="shopping-cart-table">
<thead>
<tr>
<th>Product</th>
<th> </th>
<th> </th>
<th>Unit Price</th>
<th>Qty</th>
<th>Subtotal</th>
<th> </th>
</tr>
</thead>
<tbody>
<perch:cartitems>
<tr>
<td>
<div class="shopping-cart-table__product-image">
<a href="product.php?s=<perch:cartitem id="slug"/>">
<img class="img-responsive" src="<perch:cartitem id="image" type="image" width="80" height="80" density="1.6" crop="true" />" alt="<perch:cartitem id="title" />" width="80" height="80">
</a>
</div>
</td>
<td>
<h5 class="shopping-cart-table__product-name text-left text-uppercase">
<a href="product.php?s=<perch:cartitem id="slug"/>"><perch:cartitem id="title" /></a>
</h5>
<ul class="shopping-cart-table__list-parameters">
<li class="visible-xs">
<span>Price:</span>
<span class="price-mobile"><perch:cartitem id="price_without_tax_formatted" /></span>
</li>
<li class="visible-xs">
<span>Qty:</span>
<!-- -->
<div class="number input-counter">
<span class="minus-btn"></span>
<input type="text" value="1" size="5"/>
<span class="plus-btn"></span>
</div>
<!-- / -->
</li>
</ul>
</td>
<td>
<a class="shopping-cart-table__delete icon icon-delete visible-xs" href="#"></a>
</td>
<td>
<div class="shopping-cart-table__product-price unit-price">
<perch:cartitem id="price_without_tax_formatted" />
</div>
</td>
<td>
<div class="shopping-cart-table__input">
<!-- -->
<div class="number input-counter">
<perch:cartitem id="quantity" />
</div>
<!-- / -->
</div>
</td>
<td>
<div class="shopping-cart-table__product-price subtotal">
<perch:cartitem id="total_without_tax_formatted" />
</div>
</td>
<td>
<a class="shopping-cart-table__delete icon icon-clear" href="#"></a>
</td>
</tr>
</perch:cartitems>
</tbody>
</table>
</div>
<!-- /Shopping cart table -->
<div class="divider divider--xs"></div>
<div class="clearfix shopping-cart-btns">
<perch:input type="submit" value="UPDATE SHOPPING CART" class="btn btn--ys btn--light pull-right" />
<div class="divider divider--xs visible-xs"></div>
<div class="divider divider--xs visible-xs"></div>
<a class="btn btn--ys btn--light pull-left btn-right" href="#"><span class="icon icon-keyboard_arrow_left"></span>CONTINUE SHOPPING </a>
<div class="divider divider--xs visible-xs"></div>
</div>
<div class="divider--md"></div>
<div class="row">
<div class="col-md-4">
<div class=" card card--padding">
<h4>DISCOUNT CODES</h4>
<form>
<div class="form-group">
<label for="inputDiscountCodes">Enter your coupon code if you have one.</label>
<perch:input type="text" id="discount_code" class="form-control" />
</div>
</form>
</div>
</div>
<div class="col-md-4">
</div>
<div class="divider--md visible-sm visible-xs"></div>
<div class="col-md-4">
<div class="card card--padding">
<table class="table-total">
<tbody>
<perch:if id="total_discounts" match="gt" value="0.00">
<tr class="total">
<th class="text-left">
Discount (<perch:shop id="discount_code" />)
</th>
<td class="text-right">
<perch:shop id="total_discounts" format="$:%.2n" />
</td>
</tr>
</perch:if>
<tr>
<th class="text-left">Subtotal:</th>
<td class="text-right"><perch:shop id="total_items_formatted" /></td>
</tr>
<tr>
<th class="text-left">VAT:</th>
<td class="text-right"><perch:shop id="total_tax_formatted" /></td>
</tr>
</tbody>
<tfoot>
<tr>
<th>GRAND TOTAL:</th>
<td><perch:shop id="grand_total_formatted" /></td>
</tr>
</tfoot>
</table>
<a href="checkout.php" class="btn btn--ys btn--full btn--xl">PROCEED TO CHECKOUT <span class="icon icon--flippedX icon-reply"></span></a>
<div class="text-right link-top">
</div>
</div>
</div>
</div>
</div>
</div>
<!-- End CONTENT section --> </perch:form>
<perch:else />
<h1 class="text-center text-uppercase title-under">Your cart is empty.</h1>
</perch:if>
Please post your Diagnostic Report and the PHP pages that do the adding to cart.
Diagnostics
product.html
cart.html
The cart is trying to find a product ID that doesn't exist. How has the item been added to the cart?
So I need to add the SKU to the cart page? This is my add tor cart button
When you load the page, what value is populated in the
product
hidden field?YWRkX3RvX2NhcnQ6cGVyY2hfc2hvcDpcdGVtcGxhdGVzXHNob3BccHJvZHVjdHNccHJvZHVjdC5odG1sOjE1MTU2NjY0MDA
That value is the form control, so if it's ending up in your
product
field you've got big issues but would explain the problem you're seeing.Can you double check?
I'm not really sure what you want me to double check?
is that really what is ending up in the product field?
I apologise it's this:
Is product
12
a valid product in your system?Yes it is see debug on product