You are here:  » vouchers.php "view products" to "no results found"


vouchers.php "view products" to "no results found"

Submitted by gdi on Mon, 2020-10-05 21:39 in

Hi,
I have a couple of voucher codes and I see the voucher codes applied in the product list, but if I open vouchers.php and I click to the button "view products" next to the voucher code, it opens a search page with No results found.

Any hint? Do I make any mistake?
I have niche mode enabled

Submitted by support on Tue, 2020-10-06 06:51

Hi gdi and welcome to the forum!

That sounds like you may have level 2 voucher code integration set as follows at line 41 of config.advanced.php

  $config_useVoucherCodes = 2;

...but not yet re-imported all feeds; as with level 2 integration the voucher code is only applied at import time.

If that's not the case of course, let me know and I'll check it out further with you...

Cheers,
David.
--
PriceTapestry.com

Submitted by gdi on Tue, 2020-10-06 10:08

Hi David,
thanks,
no actually I have $config_useVoucherCodes = 1;
I also reimported products several times and no change.

So I don't have any issue to see the coupon added to the products in products.php list
I just don't see any result in
search.php?q=voucher:ShopName:123Coupon

Submitted by gdi on Tue, 2020-10-06 10:47

OK,
I found out I had $config_useVoucherCodes = 1 instead of
$config_useVoucherCodes = 2

now 1 voucher code shows the list of products related to it, but the other one doesn't
the one which works correctly is applied to a product name, the one showing a void list of results is applied to the entire shop inventory

Submitted by support on Tue, 2020-10-06 10:50

Hi,

Is the date and (less importantly) time correct on your server? You can make a test.php script with the following code to check;

<?php
  
print date("c");
?>

Thanks,
David.
--
PriceTapestry.com

Submitted by gdi on Wed, 2020-10-07 17:07

Hi,
I got this time 2020-10-07T18:55:44+02:00 which matches my computer time.

I think it is more a category issue. Is it possible?

so resuming my issue:
1. I switched to $config_useVoucherCodes = 2;
2. I have 2 coupons, one with product name exact matching, the other one with category matching
3. After $config_useVoucherCodes = 2; I can see the products list in search.php?q=voucher:store:coupon just on the coupon that matches the product name
4. On the coupon that matches category, if I open the search.php?q=voucher:store:coupon page I get a void list with no products and without merchant and brand select lists before the results list
5. I can see both coupons applied correctly in products.php
6. I also have some problem with categories cause if I click Category on the top of the page I see a load spinner for 1 second and then nothing happens
7. I have niche mode enabled
8. I use just product mapping with regexp and I set the category manually for each product
9. I applied this modification to the database so I can store all products matching the regexp https://www.pricetapestry.com/node/5763#comment-23464

Thanks again for your help

Submitted by support on Thu, 2020-10-08 07:35

Hi,

Thanks for the details - i've just double checked everything through on my test server and all looks OK with Exact Match/Category for voucher codes level 2 - please could you make a temporary modification to reveal the SQL being generated for the search results page showing no results by editing search.php and look for the following code at line 348:

    $numRows = database_querySelect($sql,$rows);

...and REPLACE with:

    print $sql;exit();
    $numRows = database_querySelect($sql,$rows);

Then view the page and the SQL will be revealed, then remove the mod to restore your site. If you could then please email me the query i'll check it out further with you...

Thanks,
David.
--
PriceTapestry.com

Submitted by Antony on Sun, 2020-10-11 15:47

Hi David,

I have the same issue as above, the voucher codes applied in the product list, but if I open vouchers.php and I click to the button "view products" next to the voucher code, it opens a search page with No results found.

I have $config_useVoucherCodes = 1;

I also re-imported products several times and no change.

The coupons appear fine in both voucher.php and product.php list but don't see any result in
search.php?q=voucher:ShopName:123Coupon from the voucher.php page

Any idea where I should look?

Thanks,

Antony

Submitted by support on Mon, 2020-10-12 07:24

Hi Antony,

The issue above was regarding characters required in the discount description - if that might be the case to correct, edit search.php and look for the following code at line 185:

            $where .= " AND voucher_code = '".database_safe($voucher["code"]).($voucher["discount_text"]?" (".$voucher["discount_text"].")":"")."' ";

...and REPLACE with:

            $where .= " AND voucher_code = '".database_safe($voucher["code"]).($voucher["discount_text"]?" (".database_safe($voucher["discount_text"]).")":"")."' ";

Cheers,
David.
--
PriceTapestry.com

Submitted by Antony on Mon, 2020-10-12 09:16

Hi David,

Thanks but this it not it (I did give it a go);

The search.php?q=voucher:XXX:XXX seem to work all fine and displays the products perfectly with these settings: $config_useVoucherCodes = 2;

I mean that's fine as I manually create and manage my own feeds. Just not sure why its not working with "1"

Thanks,

Ant

Submitted by support on Mon, 2020-10-12 10:40

Hi Ant,

Please could you make the temporary change suggested above in this comment and forward the SQL being generated and I'll check it out further with you...

Cheers,
David.
--
PriceTapestry.com

Submitted by Antony on Tue, 2020-10-13 07:21

Hi David,

This is the SQL revealed:

{code saved}

Thanks,

Antony

Submitted by support on Tue, 2020-10-13 08:18

Hi Antony,

Thanks - it's a level 1 issue regarding price range (where there is no price range in this case), apologies for the inconvenience. To correct, edit search.php and look for the following code at line 211:

            if ($voucher["min_price"])
            {
              $where .= " AND price >= '".database_safe($voucher["min_price"])."' ";
            }
            if ($voucher["max_price"])
            {
              $where .= " AND price <= '".database_safe($voucher["max_price"])."' ";
            }

...and REPLACE with:

            if ($voucher["min_price"] > 0)
            {
              $where .= " AND price >= '".database_safe($voucher["min_price"])."' ";
            }
            if ($voucher["max_price"] > 0)
            {
              $where .= " AND price <= '".database_safe($voucher["max_price"])."' ";
            }

Cheers,
David.
--
PriceTapestry.com

Submitted by Antony on Tue, 2020-10-13 09:27

Thanks David, works great now!

Best,

Ant