You are here:  » Merchant Information

Active Forum Topics


Merchant Information

Submitted by babyuniverse on Sat, 2021-07-10 07:15 in

Hi David,

Hope you have been well!!

I am refreshing some of my sites and would like your help woith the following.

Merchant Information.
I currently use an existing modification so when I add merchant.html into a folder it displays on the search results page. This is hard to keep up to date.

Is there a way to use the database to add a merchant description (similar to how the merchant_logo.php works). I select an existing merchant from admin and then add description or html, which can be updated as required.

I could then display this on the merchant search results page and add css etc to it.

I hope this makes sense

Thanks
Richard

Submitted by support on Mon, 2021-07-12 08:16

Hi Richard,

Check out this comment which I think is exactly what you're after...

Cheers,
David.
--
PriceTapestry.com

Submitted by babyuniverse on Fri, 2021-07-16 10:42

Thanks Mate, That's perfect.

1 question, I currently have the following in search.php

{code saved}

To create the META description for each merchant. (im using generic text).

How would I add the new merchant_info description to that?

Submitted by support on Fri, 2021-07-16 11:48

Hi,

Add the following immediately after that line to pull in the merchant description...

    if ($parts[0]=="merchant")
    {
      $sql = "SELECT info FROM `".$config_databaseTablePrefix."merchant_info`
        WHERE name = '".database_safe($parts[1])."'";
      if (database_querySelect($sql,$rows))
      {
        $header["meta"]["description"] .= " ".$rows[0]["info"];
      }
    }

Cheers,
David.
--
PriceTapestry.com

Submitted by babyuniverse on Sat, 2021-07-17 04:27

That's awesome.

Can I use this code on each individual product? After the current description.

$sql = "SELECT info FROM `".$config_databaseTablePrefix."merchant_info`
WHERE name = '".database_safe($parts[1])."'";
if (database_querySelect($sql,$rows))
{
print $rows[0]["info"];
}

Submitted by support on Mon, 2021-07-19 07:35

Hi,

Bear in mind that the product page is product rather than merchant specific however with almost identical code you could pull in the merchant description of the cheapest merchant by editing html/product.php and look for the following cdoe at line 58:

      <p><?php print $product_main["description"]; ?></p>

...and REPLACE with:

      <p><?php print $product_main["description"]; ?></p>
      <?php
        $sql = "SELECT info FROM `".$config_databaseTablePrefix."merchant_info`
        WHERE name = '".database_safe($product_main["merchant"])."'";
        if (database_querySelect($sql,$rows))
        {
          print "<p>".$rows[0]["info"]."</p>";
        }
      ?>

Alternatively, you could pull in the merchant_info for every merchant that sells the product and include it in the price comparison table, for example below the original product name by editing html/prices.php and looking for the following code at line 57:

            <td class='hide-for-small-only'><?php print $product["original_name"]; ?></td>

...and REPLACE with:

            <td class='hide-for-small-only'>
              <?php print $product["original_name"]; ?>
              <?php
                $sql = "SELECT info FROM `".$config_databaseTablePrefix."merchant_info`
                WHERE name = '".database_safe($product["merchant"])."'";
                if (database_querySelect($sql,$rows))
                {
                  print "<p>".$rows[0]["info"]."</p>";
                }
              ?>
            </td>

Cheers,
David.
--
PriceTapestry.com

Submitted by babyuniverse on Sun, 2021-07-25 04:46

Hi David,

That worked perfectly. I have now implemented https://www.pricetapestry.com/node/6150#comment-25040

I have added the following code to searchresults.php

<?php
  
if (($page==1) && isset($parts[1]) && ($parts[0]=="merchant"))
  {
    
$sql "SELECT * FROM `".$config_databaseTablePrefix."merchant_info` WHERE name='".database_safe($parts[1])."'";
    if (
database_querySelect($sql,$rows))
    {
      print 
"<div class='row'><div class='small-12' columns style = 'padding: 0px; font-size:18px;'><p class='merchant_info'>".$rows[0]["info"]."</p></div></div>";
    }
  }
 
?>

This is working fine, however I would now like to bring in the merchant logo for this.

Can you help?

Thanks
Richard

Submitted by support on Mon, 2021-07-26 07:22

Hi Richard,

Sure - have a go with something like;

<?php
  
if (($page==1) && isset($parts[1]) && ($parts[0]=="merchant"))
  {
    
$sql "SELECT * FROM `".$config_databaseTablePrefix."merchant_info` WHERE name='".database_safe($parts[1])."'";
    if (
database_querySelect($sql,$rows))
    {
      print 
"<div class='row'><div class='small-12 columns' style='padding:0px;font-size:18px;'>";
      print 
"<p class='merchant_info'>";
      if (
file_exists("logos/".$parts[1].$config_logoExtension))
      {
        print 
"<img src='".$config_baseHREF."logos/".str_replace(" ","%20",$parts[1].$config_logoExtension)."' />";
      }
      print 
$rows[0]["info"];
      print 
"</p>";
      print 
"</div></div>";
    }
  }
?>

Cheers,
David.
--
PriceTapestry.com

Submitted by babyuniverse on Mon, 2021-07-26 08:55

Thanks Mate.

The logo is coming back as https://example.com/logos/.img
Doesn't seem to be getting the merchant name/

Submitted by support on Mon, 2021-07-26 10:08

Sorry about that had $product["merchant"] instead of $parts[1]. Corrected above...

Cheers,
David.
--
PriceTapestry.com

Submitted by babyuniverse on Mon, 2021-07-26 12:26

That seems to break it.

Submitted by support on Mon, 2021-07-26 13:07

Ooops - deleted a closing bracket making the last mod - should be OK now...!

Cheers,
David.
--
PriceTapestry.com