Posts by tonyastley

    Setting the products to inactive is an option, but has the following issues:

    • Sometimes a product simply has to be removed at the clients request (ease of updating etc).
    • Sometimes a product is mistakenly deleted by the clients admin.

    As mentioned the orders display perfectly in the back end, could the same code from /addons/apps/perch_shop_orders/modes/ be repurposed for the perch_shop_order function?

    This part of debug has me worried this will require a fix from Drew as the system looks for the product ID and checks deletion, but something isn't working correctly:

    SELECT * FROM perch3_shop_customers WHERE memberID=3

    [1] SELECT * FROM perch3_shop_orders WHERE customerID=3 AND orderID=21 AND orderStatus IN ('paid', 'processing', 'cancelled', 'dispatched', 'returned', 'partial_refund', 'refunded')

    [2] SELECT * FROM perch3_shop_order_items WHERE orderID='21' ORDER BY itemID ASC

    [1] SELECT * FROM perch3_shop_order_statuses WHERE statusKey='paid' AND statusDeleted IS NULL LIMIT 1

    [1] SELECT * FROM perch3_shop_currencies WHERE currencyID=47 LIMIT 1

    [1] SELECT * FROM perch3_shop_shippings WHERE shippingID=4 AND shippingDeleted IS NULL LIMIT 1

    [1] SELECT * FROM perch3_shop_products WHERE productID=144 AND productDeleted IS NULL LIMIT 1

    [1] SELECT * FROM perch3_shop_currencies WHERE currencyActive=1 AND currencyID=47

    [1] SELECT promoID FROM perch3_shop_order_promotions WHERE orderID=21

    [1] SELECT * FROM perch3_shop_promotions WHERE promoID=1 LIMIT 1

    [1] Using template: /templates//shop/orders/order_better.html

    Hello Byron, thanks for the response.

    The orders are historic orders, they show OK in the admin area, and you can see the ID of the order from the admin OK.

    New orders placed work perfectly fine - until the product or variant within the order is deleted, they then show the same fatal error.

    I'll include the page anyway for you. You can ignore the shipping and billing stuff, I had to jump through hoops to show that on the order :rolleyes:.

    Here is order_better.html:

    When displaying an order using:

    1. <?php
    2. perch_shop_order($orderID, [
    3. 'template' => '/shop/orders/order.html'
    4. ]);
    5. ?>

    If the product is deleted from the catalog the order returns a fatal error:

    Fatal error: Uncaught Error: Call to a member function to_array() on boolean in /pathto/site-folder/kpanel/addons/apps/perch_shop/lib/PerchShop_Order.class.php:538 Stack trace: #0 /pathto/site-folder/kpanel/addons/apps/perch_shop/lib/PerchShop_Order.class.php(393): PerchShop_Order->format_invoice_for_template(Array) #1 /pathto/site-folder/kpanel/addons/apps/perch_shop/lib/PerchShop_Order.class.php(402): PerchShop_Order->get_for_template() #2 /pathto/site-folder/kpanel/addons/apps/perch_shop/lib/PerchShop_Runtime.class.php(765): PerchShop_Order->template(Array) #3 /pathto/site-folder/kpanel/addons/apps/perch_shop/runtime/orders.php(62): PerchShop_Runtime->get_order_items(Array) #4 /pathto/site-folder/kpanel/templates/pages/shop/account/orders.php(8): perch_shop_order('16', Ar in /pathto/site-folder/kpanel/addons/apps/perch_shop/lib/PerchShop_Order.class.php on line 538

    Oddly the order information displays OK in the admin area, it just throws an error on the front end - obviously the customer will need to be able to reference historic orders, even for products that have since been deleted.

    Can this be fixed?

    Hello Byron, I think it's all related to some malformed variants. I encountered another issue where search was matching the first variant as well as the product itself.

    I deleted the first variant from the variants tab and generated new variants - this has fixed this issue.

    I believe everything is standard apart from the blocks editor I have added to the end.

    When searching Perch Shop - the results are returning the first variant of a product if the product has variants.

    However the result_url returned in the search results does not contain the path to the parent product.


    Search for "French"correctly returns this product:

    result_title: French Door Tester

    result_url: /shop/products/french-door-french-door

    However it also returns the first variant of that product (I found it from the product ID):

    result_title: French Door (This is actually incorrect - it should show the updated title as above?)

    result_url: /shop/products/ (Not sure what is happening here?)

    The variant not updating the parent name is odd, but the result_url breaks the results.

    Can anyone help shed some light on how to fix this issue, or work around it?

    I've managed to get Perch shop search working using code I the following found in the forum.

    1. <?php perch_search_form(); ?>
    2. <?php $query = perch_get('q'); perch_content_search($query, array( 'count'=>12, 'apps' => ['PerchShop'], )); ?>

    There is a PHP error notice above the search results:

    1. 'Notice: Undefined index: description in /pathto/site-folder/kpanel/addons/apps/perch_shop/lib/PerchShop_SearchHandler.class.php on line 69' 

    I've not been near this file, and have actually replaced the whole lib directory with a fresh download just in case but the error persists.

    Can anyone help identify what is causing the problem please?

    I'm trying to find a better way to display the shipping options to the customer in a form with radio buttons.

    The label for each radio button will contain the standard shipping details sorted by cost (or at least priority):

    - Title
    - Description

    - Courier

    - Price

    Then have the form submit as the user so they don't have to keep pressing 'update shipping'

    Here is the shipping method template with radios (template borrowed from:…shipping-method-in-shop):


    1. perch_shop_shipping_method_form(['template' => 'shippings/method_form_radio.html']);

    HTML for method_form_radio.html

    My current attempt involves using a hidden set of options using perch_shop_shipping_options(); and using javascript to copy the content into the radiowrapper div within the form, this seems anything but ideal but kinda gets the job done.

    However I cannot seem to:

    A: Control the order of the options generated by 'shippings_list' - I would like to sort by cost, or at least priority?
    B: Get the form to submit when a radio is changed ($('#form1_shipping_method').submit(); does not work?).

    Is this possible?

    I'm developing the checkout process for Perch shop and have come across a bug.

    When a customer adds a new address, if the address has the same address line 1 as an existing address - the addressSlug created also matches the existing address, resulting in 2 addresses with the same addressSlug.

    This becomes an issue when selecting an address during the checkout process as addressSlug is used as the value on the radio button.

    I appreciate this is an edge case, but a customer might want to deliver to a different name at the same address.

    Is there a way to use the addressID instead of the slug as the value for differentiating addresses?