Posts by juanfernandes_uk

    I recently started noticing a weird issue, where when I logged into my perch site, currently in development.


    The issue is that it was showing different content than I expect, if you see the image bellow, the Pages on the right are the correct ones.


    At first I thought this was an issue with Firefox and then I found that the issue is that it seems to think that HTTP and HTTPs are 2 seperate sites!



    I don't know how I have ended up with this but I'd like to fix this issue before it goes live. Live website is on a different domain name but it works fine.


    Anyone have any ideas?

    Hi all,


    Could someone explain to me how to get trade_price working.


    I'm wanting to use trade_price as a way to show discounted prices for members.


    So I have a test product with a trade price, as well as a normal price.


    In the trmplate I'm using if/else to show trade_price if it exists or main price. This shows the trade price.


    At the top of each page, I'm checking if the user is logged in and has a member tag if full.


    The cart is where I'm having an issue, the item price is correct, but the total shows the main price, not the trade price. but there isn't a trade_price_total I can use - is there?


    PHP: cart.html
    1. <perch:if exists="trade_price">
    2. <perch:cartitem id="trade_price" type="shop_currency_value" />
    3. <perch:else />
    4. <perch:cartitem id="price" type="shop_currency_value" />
    5. </perch:if>


    PHP: product.html
    1. <perch:if exists="trade_price">
    2. <perch:shop id="trade_price" type="shop_currency_value" />
    3. <perch:else />
    4. <perch:shop id="price" type="shop_currency_value" />
    5. </perch:if>


    PHP: product.php, cart.php and checkout.php
    1. <?php include($_SERVER['DOCUMENT_ROOT'].'/perch/runtime.php');
    2. perch_layout('global.header');
    3. if (perch_member_logged_in() && perch_member_has_tag('full')) {
    4. perch_shop_enable_trade_pricing();
    5. }
    6. ?>


    What am I missing?


    This is the cart:


    HI all,


    I have a question about something that is a minor issue.


    I'm using the Shop add on with Stripe checkout and on the strip form, a few pieces of data are passed onto stripe, including the following:

    Code
    1. data-name="<perch:shop id="shop_name" escape="true" />"


    This outputs "Shop" in the strip modal popup.


    My question is - where does it get that value from? I'd like to change it, so it has the client name + Shop - I can do it manually, but I'd like to know where id="shop_name" is coming from.


    Thanks in advance.

    Juan

    Not sure how to word this correctly.


    Shop in development.


    Testing discount code implementation and if I apply a discount code, and say I remove all products from the cart, close my tab down, open it again, add a product to my cart - it still applies the discount code.


    Does the discount code only get 'cleared' at checkout?


    Thanks in advance.


    I believe this is related to my issue yesterday and my lack of knowledge when it comes to rewrite rules.


    If I change things so that the cart page is /shop/cart.php it works - but the rewrite rule i have for the product page is making the following URL not work - /shop/cart/


    Code
    1. RewriteRule ^shop/([a-zA-Z0-9-]+)/?$ /shop/product.php?s=$1 [L]


    I didn't realise the issues were related when I created this post Drew.

    I will need to work out a rewrite rule that covers /shop/basket/ and /shop/checkout/ and any others that are part of the process - has anyone got a htaccess file they can share?

    Hi all,

    Yesterday I had an issue where the product page wasn't showing the product detail, I added the following rewrite rule

    Code
    1. RewriteRule ^shop/([a-zA-Z0-9-]+)/?$ /shop/product.php?s=$1 [L]


    So today, working on the next step, adding an item to the cart.


    First question, can the cart page be /shop/cart/index.php or do I need to have /shop/cart.php and then have a rewrite rule?


    I ask this because, currently when I add an item to the cart, the URL changes to /shop/cart/ but its still the product page, but it not showing the product details.

    Cart page:

    PHP
    1. <?php perch_shop_cart([ 'template' => 'cart/cart.html', ]); ?>


    Debug message after item has been added to the cart:


    find_by_path(): "> [1] SELECT * FROM perch3_pages WHERE pagePath='/shop/product.php' LIMIT 1
    get(): "> [48] SELECT DISTINCT settingID, settingValue FROM perch3_settings WHERE userID=0
    get_cart_field(): "> [1] SELECT * FROM perch3_shop_cart WHERE cartID=14
    get_cart_field(): "> [1] SELECT * FROM perch3_shop_cart WHERE cartID=14
    add_to_cart(): "> [1] SELECT itemID, itemQty FROM perch3_shop_cart_items WHERE cartID=14 AND productID=0
    find(): "> [1] SELECT * FROM perch3_shop_products WHERE productID=0 AND productDeleted IS NULL LIMIT 1
    add_to_cart_from_form(): ">Limiting based on stock.
    calculate_cart(): ">------------------------------ Calculating cart ------------------------------
    get_cart_field(): "> [1] SELECT * FROM perch3_shop_cart WHERE cartID=14
    calculate_cart(): "> [1] SELECT * FROM perch3_shop_cart WHERE cartID=14
    find(): "> [1] SELECT * FROM perch3_shop_tax_locations WHERE locationID=1 AND locationDeleted IS NULL LIMIT 1
    get_value(): "> [1] SELECT locationID FROM perch3_shop_tax_locations WHERE locationIsHome=1 LIMIT 1
    find(): "> [1] SELECT * FROM perch3_shop_tax_locations WHERE locationID=1 AND locationDeleted IS NULL LIMIT 1
    find(): "> [1] SELECT * FROM perch3_shop_currencies WHERE currencyID=47 LIMIT 1
    calculate_cart(): "> [1] SELECT COUNT(productID) AS product_count, SUM(itemQty) AS item_count FROM perch3_shop_cart_items WHERE cartID=14
    recalculate_summary_data(): ">Tax mode: exc
    get_by(): "> [1] SELECT * FROM perch3_shop_cart_items WHERE cartID=14 ORDER BY itemID ASC
    find(): "> [1] SELECT * FROM perch3_shop_products WHERE productID=1 AND productDeleted IS NULL LIMIT 1
    find(): "> [1] SELECT * FROM perch3_shop_tax_groups WHERE groupID=1 AND groupDeleted IS NULL LIMIT 1
    get_value(): "> [1] SELECT r.rateValue FROM perch3_shop_tax_group_rates gr, perch3_shop_tax_rates r WHERE gr.rateID=r.rateID AND gr.groupID=1 AND gr.locationID=1
    find(): "> [1] SELECT * FROM perch3_shop_tax_groups WHERE groupID=1 AND groupDeleted IS NULL LIMIT 1
    get_value(): "> [1] SELECT r.rateValue FROM perch3_shop_tax_group_rates gr, perch3_shop_tax_rates r WHERE gr.rateID=r.rateID AND gr.groupID=1 AND gr.locationID=1
    find_matching(): "> [1] SELECT z.* FROM perch3_shop_shipping_zones z LEFT JOIN perch3_shop_shipping_zone_countries c ON z.zoneID=c.zoneID WHERE z.zoneActive=1 AND z.zoneDeleted IS NULL AND (c.countryID=236 OR zoneIsDefault=1) ORDER BY zoneIsDefault ASC LIMIT 1
    get_all_flat(): "> [1] SELECT * FROM perch3_shop_shippings WHERE shippingDeleted IS NULL ORDER BY shippingOrder ASC
    find_set(): "> [1] SELECT * FROM perch3_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
    get_edit_values(): "> [1] SELECT rateID AS id, rateTitle AS title, rateValue AS rate, locationID FROM perch3_shop_tax_rates WHERE rateDeleted IS NULL ORDER BY rateValue DESC
    {closure}(): ">Qualifying shipping method ‘Post Office’
    find(): "> [1] SELECT * FROM perch3_shop_shippings WHERE shippingID='1' AND shippingDeleted IS NULL LIMIT 1
    calculate_cart(): ">Using shipping zone: United Kingdom
    find(): "> [1] SELECT * FROM perch3_shop_tax_groups WHERE groupID=1 AND groupDeleted IS NULL LIMIT 1
    get_value(): "> [1] SELECT r.rateValue FROM perch3_shop_tax_group_rates gr, perch3_shop_tax_rates r WHERE gr.rateID=r.rateID AND gr.groupID=1 AND gr.locationID=1
    get_currently_active(): "> [nil] SELECT * FROM perch3_shop_promotions WHERE promoFrom<='2019-02-22 10:51:00' AND promoTo>'2019-02-22 10:51:00' AND promoActive=1 AND promoDeleted IS NULL ORDER BY promoOrder ASC
    update(): ">UPDATE perch3_shop_cart SET cartTotalItems='5', cartTotalProducts='1', cartTotalWithTax='1202.33', cartTotalWithoutTax='999.95' WHERE cartID='14'
    insert(): ">INSERT INTO perch3_shop_cart_data(cartID,productID,cartData) VALUES('14','','{\"product\":\"\"}')
    get_filtered_listing_from_index(): "> [nil] SELECT tbl.* FROM ( SELECT idx.itemID, main.*, idx2.indexValue as sortval FROM perch3_shop_index idx JOIN perch3_shop_products main ON idx.itemID=main.productID AND idx.itemKey='productID' JOIN perch3_shop_index idx2 ON idx.itemID=idx2.itemID AND idx.itemKey='productID' AND idx2.indexKey='_id' WHERE 1=1 AND ((idx.indexKey='slug' AND idx.indexValue='basket')) AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey GROUP BY idx.itemID, idx2.indexValue, productID ) as tbl WHERE (productDeleted IS NULL AND productStatus=1 AND parentID IS NULL) GROUP BY itemID, sortval ORDER BY sortval ASC
    set(): ">Using template: /templates/shop/products/product.html

    Thanks Drew, all working now.


    For anyone else, here is my code:


    .htaccess

    Code
    1. RewriteRule ^shop/([a-zA-Z0-9-]+)/?$ /shop/product.php?s=$1 [L]


    product.php (product detail page):


    PHP
    1. <?php $product = perch_get('s'); perch_shop_product($product); ?>

    Thanks for helping me out Drew.


    I had removed the .htaccess file completly, in the hopes it would stop using the rewrite rules, but I guess they are cached.


    Originally I was using this, which is a copy of what I used for the blog, changed for the shop:


    ```

    RewriteRule ^shop/([a-zA-Z0-9-/]+)$ /shop/product.php?s=$1 [L]

    ```


    There is a slash here '([a-zA-Z0-9-/]+)' - is that the trailing slash?


    ```

    RewriteRule ^shop/([a-zA-Z0-9-]+)$ /shop/product.php?s=$1 [L]

    ```


    I didn't want to just try it and they have it cached again.

    Array
    ( [s] => my-test-product/)


    Debug:

    find_by_path(): "> [1] SELECT * FROM perch3_pages WHERE pagePath='/shop/product.php' LIMIT 1
    get(): "> [48] SELECT DISTINCT settingID, settingValue FROM perch3_settings WHERE userID=0
    get_cart_field(): "> [1] SELECT * FROM perch3_shop_cart WHERE cartID=3
    get_cart_field(): "> [1] SELECT * FROM perch3_shop_cart WHERE cartID=3

    Doing that, i get the product details.


    It also shows me the output from <perch:showall> which i added to the product.html template.


    I have debug on:

    find_by_path(): "> [1] SELECT * FROM perch3_pages WHERE pagePath='/shop/product.php' LIMIT 1
    get(): "> [48] SELECT DISTINCT settingID, settingValue FROM perch3_settings WHERE userID=0
    get_cart_field(): "> [1] SELECT * FROM perch3_shop_cart WHERE cartID=3
    get_cart_field(): "> [1] SELECT * FROM perch3_shop_cart WHERE cartID=3
    get_filtered_listing_from_index(): "> [1] SELECT tbl.* FROM ( SELECT idx.itemID, main.*, idx2.indexValue as sortval FROM perch3_shop_index idx JOIN perch3_shop_products main ON idx.itemID=main.productID AND idx.itemKey='productID' JOIN perch3_shop_index idx2 ON idx.itemID=idx2.itemID AND idx.itemKey='productID' AND idx2.indexKey='_id' WHERE 1=1 AND ((idx.indexKey='slug' AND idx.indexValue='my-test-product')) AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey GROUP BY idx.itemID, idx2.indexValue, productID ) as tbl WHERE (productDeleted IS NULL AND productStatus=1 AND parentID IS NULL) GROUP BY itemID, sortval ORDER BY sortval ASC
    set(): "> [1] Using template: /templates/shop/products/product.html
    find(): "> [1] SELECT * FROM perch3_shop_brands WHERE brandID='1' AND brandDeleted IS NULL LIMIT 1
    find(): "> [1] SELECT * FROM perch3_shop_currencies WHERE currencyID=47 LIMIT 1
    find(): "> [1] SELECT * FROM perch3_shop_tax_groups WHERE groupID='1' AND groupDeleted IS NULL LIMIT 1

    Hi all,


    Wonder if anyone can help me figure out an issue I'm having - blank product detail page.

    Firstly, I'm not new to Perch, but this is the first time I'm using the Shop add-on.


    Here is my product.php page code:

    PHP
    1. <?php if (perch_get('product')) { perch_shop_product(perch_get('product'),array( 'template' => 'products/product.html' )); } else { echo "No Product Selected"; } ?>


    I'm using the default product.html template, copied to perch/templates/shop/products/ and added <perch:showall> (which is not showing anything)

    Debug: no errors


    Console: no errors

    Rewrite rule in .htacess:

    Code
    1. RewriteRule ^shop/(.+)$ shop/product.php?product=$1 [L]


    Any ideas what I've done wrong? Thanks in advance.