You are here:  » merchant name on import


merchant name on import

Submitted by nosferatu on Tue, 2008-02-19 09:55 in

Hi David,

Is There any way to import with a merchant name like this e-site.com
When I put - on merchant name it give this error: invalid characters.
I have 2 merchants withs this name ( example not real name) esites.com and e-sites.com

How can I make the import?

Submitted by support on Tue, 2008-02-19 12:39

Hi,

The reason "-" is restricted is that the search engine friendly URLs are constructed with hyphens in place of spaces.

However, I have worked out a solution. There is an alternative hyphen in the extended character set that can be used. To make it easy to register merchant names including a hyphen, what I suggest is adding code to replace the normal hyphen with the extended character set hyphen, which means that you can register the merchant name using a normal hyphen.

To do this, in admin/feeds_register_step2.php, look for the following code, beginning at line 24:

    elseif( !ereg("^[0-9a-zA-Z\. ]{1,255}$",$_POST["merchant"]) )
    {
      widget_errorSet("merchant","merchant name missing or contains invalid characters");
    }

Replace this with the following version so that the normal hyphen is permitted:

    elseif( !ereg("^[-0-9a-zA-Z\. ]{1,255}$",$_POST["merchant"]) )
    {
      widget_errorSet("merchant","merchant name missing or contains invalid characters");
    }

Now to make the substitution, look for the following code on line 63:

admin_register($filename,$format,$_POST["merchant"],$_POST["fieldName"], (isset($_POST["fieldDescription"])?$_POST["fieldDescription"]:"") , (isset($_POST["fieldImageURL"])?$_POST["fieldImageURL"]:"") ,$_POST["fieldBuyURL"],$_POST["fieldPrice"],$_POST["fieldCategory"],$_POST["userCategory"],$_POST["fieldBrand"],$_POST["userBrand"]);

Replace this with:

admin_register($filename,$format,str_replace("-","‑",$_POST["merchant"]),$_POST["fieldName"], (isset($_POST["fieldDescription"])?$_POST["fieldDescription"]:"") , (isset($_POST["fieldImageURL"])?$_POST["fieldImageURL"]:"") ,$_POST["fieldBuyURL"],$_POST["fieldPrice"],$_POST["fieldCategory"],$_POST["userCategory"],$_POST["fieldBrand"],$_POST["userBrand"]);

Finally, in includes/admin.php, look for the following code, beginning at line 21:

    if (!ereg("^[0-9a-zA-Z\. ]{1,255}$",$merchant))
    {
      return "merchant missing or contains invalid characters";
    }

Again, replace this as follows in order to permit the new hyphen character:

    if (!ereg("^[0-9a-zA-Z\.‑ ]{1,255}$",$merchant))
    {
      return "merchant missing or contains invalid characters";
    }

That should do the trick - you can then register a merchant name with hyphens as normal and they will be converted to the "safe" hyphen that can be used in search engine friendly URLs alongside the normal hyphen.

Cheers,
David.

Submitted by Harry on Tue, 2009-02-10 11:25

Hi David,

I have the same problem and tried this code above, but the substitution doesn´t work, because I can´t get the special hyphen is not available in my character set.

What would be happend, if I allow normal hyphen in the merchant name and don´t make the substitution on line 63 ?

Submitted by support on Tue, 2009-02-10 11:27

Hi Harry,

That should be ok...end result will be the same.

Cheers,
David.

Submitted by Harry on Tue, 2009-02-10 12:14

I tried it....
after registering the merchant name e-site
the result is that "e site" is diplayed...so the hyphen was accepeted but somewhere replaced with a space.

Submitted by support on Tue, 2009-02-10 12:22

Hi Harry,

Sorry, yes - I understand.

What character set are you using? Assuming iso-8859-1, there is a soft-hyphen at character 173, so you could try this code as the replacement on line 63:

str_replace("-",chr(173),$_POST["merchant"])

Cheers,
David.

Submitted by philstone on Fri, 2013-11-15 23:10

Hi David
hope your well, I wish to enable hyphens in merchant names
Which changes would need to be made in the current script as the files seem very different now?

regards

Phil Stone
www.buy24-7.net

Submitted by support on Sun, 2013-11-17 10:30

Hello Phil,

To remove restrictions on the merchant name first look for the following code in admin/feeds_register_step2.php at line 26:

elseif (($_POST["field_merchant"]=="") && (!preg_match("/^[0-9a-zA-Z\. ]{1,255}$/",$_POST["merchant"])))

...and REPLACE with just:

elseif ($_POST["field_merchant"]=="")

Then in includes/admin.php, look for the following code beginining at line 330 (12/10B) / 332 (13/03A) :

    /* construct merchant value */
    if ($admin_importFeed["field_merchant"])
    {
      $importRecord["merchant"] = $record[$admin_importFeed["field_merchant"]];
      $importRecord["merchant"] = tapestry_normalise($importRecord["merchant"],"\.");
    }
    else
    {
      $importRecord["merchant"] = $admin_importFeed["merchant"];
    }

...and REPLACE with:

    /* construct merchant value */
    if ($admin_importFeed["field_merchant"])
    {
      $importRecord["merchant"] = $record[$admin_importFeed["field_merchant"]];
    }
    else
    {
      $importRecord["merchant"] = $admin_importFeed["merchant"];
    }
    $importRecord["merchant"] = str_replace("-","‑",$importRecord["merchant"]);

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by philstone on Mon, 2013-11-18 21:59

Thanks for that David

out of interest how would i get a logo to appear when the hyphen is used? doesn't seem to be working

regards

Phil Stone
www.buy24-7.net

Submitted by support on Tue, 2013-11-19 11:35

Hi Phil,

It's probably easiest to remove the hyphen from the merchant name as used in the logo filename, so in html/prices.php within line 11:

<?php print (file_exists("logos/".$product["merchant"])?"<img alt='".$product["merchant"]."' src='".$config_baseHREF."logos/".str_replace(" ","%20",$product["merchant"])."' />":$product["merchant"]); ?>

...REPLACE with

<?php
$logoMerchantName = str_replace("-"," ",$product["merchant"]);print (file_exists("logos/".$logoMerchantName)?"<img alt='".$product["merchant"]."' src='".$config_baseHREF."logos/".str_replace(" ","%20",$logoMerchantName)."' />":$product["merchant"]); ?>

Cheers,
David.
--
PriceTapestry.com

Submitted by philstone on Tue, 2015-02-03 14:25

Hi David

I'm trying to register a merchant on the 15/01A (beta) with merchant name: name.co.uk, but its not allowing the registration, I have tried the fix above without success, could you please advise on this

regards

Phil Stone
www.buy24-7.net

Submitted by support on Tue, 2015-02-03 14:50

Hello Phil,

I'll address this in the distribution - in the mean time, to permit "." during validation of normalised types, if you edit includes/widget.php and look for the following code at line 336:

  if ($_POST[$postVar]!=tapestry_normalise($_POST[$postVar]))

...and REPLACE with:

  if ($_POST[$postVar]!=tapestry_normalise($_POST[$postVar],"\."))

Cheers,
David.
--
PriceTapestry.com

Submitted by philstone on Tue, 2015-02-03 15:03

Thanks David

I tried that, unfortunately when i make the change i only see a blank white page when i go to register the feed? or any feed, not sure why though?

regards

Phil Stone
www.buy24-7.net

Submitted by support on Tue, 2015-02-03 15:05

Apologies Phil, a bracket went missing...

Corrected above!

Cheers,
David.
--
PriceTapestry.com

Submitted by philstone on Tue, 2015-02-03 15:10

perfect - thanks!!

regards

Phil Stone
www.buy24-7.net

Submitted by Retro135 on Sun, 2015-07-05 00:36

How do I include a hyphen in merchant's name?

I tried the above but changed the . to a - for merchants with a hyphen (also using 15 beta) but this didn't work. Previous fix can't work as code is completely different.

Submitted by support on Mon, 2015-07-06 08:02

Hi,

The latest version has the regular expression used to make "URL tidy" (normalised) versions of the product name / merchant name / category / brand etc. in config.advanced.php at line 90:

  $config_normaliseRegExp = "A-Za-z0-9".chr(0x80)."-".chr(0xFF)." ";

However, enabling a hyphen would require changes to the URL structure since a hyphen is used in place of spaces to generate clean, search engine friendly URLs. However, there are 2 hyphen characters in the UTF-8 character set that appear visually identical to the minus sign typically used as a hyphen, which are:

UTF-8 Hyphen:

UTF-8 Non-breaking Hyphen:

If you want to give these a go, use a direct copy / paste from the above to ensure that the correct characters is copied; however some browsers may encode these characters in the URL which is the tradeoff. If using merchant logos I would suggest not using hyphens in the merchant name as the name is never actually displayed in text throughout the site...

Cheers,
David.
--
PriceTapestry.com

Submitted by Retro135 on Mon, 2015-07-06 13:32

Unfortunately, merchant names are displayed:

{link saved}

I tried the non-breaking hyphen: came up as a ? in the name and went to an error page. I'll live with no hyphens! :-)

Submitted by Perce2 on Fri, 2017-12-15 10:33

Hi David,

I have a similar problem with getting the merchant logo's to show for 3 merchants having .com after their names. They register ok, just can't get the logo's to display. This site uses version 15/01A and is quite heavily modded, so would like to keep the same version.

I would prefer to not change the names as some may think it's a different company.
I notice the same merchants listed in another site using version 15/09A display ok, so hopefully not something major. Is there a fix ?

Thanks.

Submitted by support on Fri, 2017-12-15 13:38

Hi,

15/09A introduced the logo filename extension configuration parameter - I know you have been using the script for several years now so I'm wondering if you upgraded to 15/10A and set it to an empty string at line 96 in config.advanced.php for example:

  $config_logoExtension = "";

If that's the case, I would recommend setting it back to the default of .img e.g.;

  $config_logoExtension = ".img";

...and then renaming all your logos with the .img extension on the end. It was becauuse of merchant names ending ".com" (not uncommon in the eCommerce world) that I added the extension because .com is an executable program file extension under Microsoft Windows, and many anti-virus and malware protection programs will block any HTTP requests to a resouce ending in ".com"...

Cheers,
David.
--
PriceTapestry.com