Zen Cart Logo
Forums / Addon Admin Tools / Structured Data Markup for Schema, Facebook Open Graph, Twitter...

Structured Data Markup for Schema, Facebook Open Graph, Twitter...

Views: 91,626

Results 61 to 80 of 212
3 May 2020, 5:47 PM
#61
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,874
Plugin Contributions:
7

Structured Data Markup for Schema, Facebook Open Graph, Twitter...

I assume you are using the version from Github...if not, please do so.

1. Is the plugin multilingual?
The things it displays are almost all scraped from the page so will be in the page language.
But, constants entered in the admin page are used directly. If you want those different, then you will have to change the constant name, make new ones and put them in the /language/extra_defines folder.

So, if you enter japanese in the admin, it gets garbled in the plugin output somewhere?
Can you put an example of the admin text and a screenshot of the output?

3. I presume one does not need any re-writer for the product URLs.
Dunno I use CEON. I will try with a test site.

3 May 2020, 6:26 PM
#62
gernot avatar

gernot

Zen Follower

Join Date:
Feb 2017
Location:
Tokyo, Japan
Posts:
334
Plugin Contributions:
0

Re: Structured Data Markup for Schema, Facebook Open Graph, Twitter...

Hi torvista,
Many thank for the feedback. Yes, I am using your Master from Github, from 9 May 2019 when I look at my download history. Sorry, I did not update the download and installation, finally got around to entering the Admin constants after getting more or less up to speed on what they all do, among other things.

  1. So that is how it works. Cool! I will keep that in mind, and do stuff in English for now, then look at adding Japanese later on (this is for address information, shop name, etc.).
    The output does not get garbled as such, it is written as unicode character codes (\u....\u....) rather than the actual characters. I will put one up shortly so you can see. It was the address information I had wanted to put in Japanese primarily since I am in Tokyo. But it seems English is always acceptable to Google, as far as I could tell from reading, so I do not think I am losing out practically.

  2. Thanks. I don't think this has anything to do with the plugin, after all if FB says it gets a 404 for a URL with quesry string, that is simply a non-starter. Twitter and Google have no trouble though.

3 May 2020, 6:40 PM
#63
gernot avatar

gernot

Zen Follower

Join Date:
Feb 2017
Location:
Tokyo, Japan
Posts:
334
Plugin Contributions:
0

Re: Structured Data Markup for Schema, Facebook Open Graph, Twitter...

Hi torvista,
I do not know why, but now, the UTF-8 appears fine when I set it in Japanese characters!
However, one other item, "Home", in the bottom line, is odd when it is displayed in Japanese language.

Here is the extract for JSON for the home page, when the site is viewed in English:

            "@type": "PostalAddress",
   "streetAddress" : "牟礼2-11-24-304",
  "addressLocality": "三鷹市",
    "addressRegion": "東京都",
       "postalCode": "181-0002",
  "addressCountry" : "JP"
                 }
}
</script>
<script type="application/ld+json" title="schemaBreadcrumb">
{
       "@context": "http://schema.org",
          "@type": "BreadcrumbList",
"itemListElement": [
  {
      "@type": "ListItem",
   "position": 1,
       "item": {
           "@id": "https://www.proteawines.jp/shop/index.php?main_page=index",
          "name": "Home"
               }

Here is the extract for JSON for the home page, when the site is viewed in Japanese:

            "@type": "PostalAddress",
   "streetAddress" : "牟礼2-11-24-304",
  "addressLocality": "三鷹市",
    "addressRegion": "東京都",
       "postalCode": "181-0002",
  "addressCountry" : "JP"
                 }
}
</script>
<script type="application/ld+json" title="schemaBreadcrumb">
{
       "@context": "http://schema.org",
          "@type": "BreadcrumbList",
"itemListElement": [
  {
      "@type": "ListItem",
   "position": 1,
       "item": {
           "@id": "https://www.proteawines.jp/shop/index.php?main_page=index",
          "name": "\u30db\u30fc\u30e0"
               }
```The last entry, for "name" is Japanese katakana characters "ホーム", the translation of "Home". All my files are UTF-8, as far as I know, and so is the database (again, as far as I know).

I know I saw the address also in the same format earlier, since I particularly took note of the streetAddress having \u...\u...2-11-24-304, and similarly with the addressLocality (city) and addressRegion (prefecture). Maybe I had not see addressCountry correctly yet (I initially had it as 日本, i.e. "Japan" in Japanese, rather than the 2-letter code).
4 May 2020, 12:14 PM
#64
gernot avatar

gernot

Zen Follower

Join Date:
Feb 2017
Location:
Tokyo, Japan
Posts:
334
Plugin Contributions:
0

Re: Structured Data Markup for Schema, Facebook Open Graph, Twitter...

Hi torvista,
I did a quick check again on FB URLs.

For main page, no problems

  1. https://www.proteawines.jp/shop/index.php?main_page=index
  2. https://www.proteawines.jp/shop/index.php?main_page=index&language=ja

Then, for category pages, again, no problem:

  1. https://www.proteawines.jp/shop/index.php?main_page=index&cPath=82
    Although FB does note that "&" in the URL does not match the URI-escaped version in the og:url property.
<meta property="og:url" content="https://www.proteawines.jp/shop/index.php?main_page=index&amp;cPath=82" />

For product pages, this is where FB returns a 404.

  1. https://www.proteawines.jp/shop/index.php?main_page=product_info&cPath=82&products_id=188
    Here the og:url property is missing the category!
<meta property="og:url" content="https://www.proteawines.jp/shop/index.php?main_page=product_info&amp;products_id=188" />

I don't know if this is an issue with how I set up the plugin, or if this looks like a bug?

4 May 2020, 1:02 PM
#65
gernot avatar

gernot

Zen Follower

Join Date:
Feb 2017
Location:
Tokyo, Japan
Posts:
334
Plugin Contributions:
0

Re: Structured Data Markup for Schema, Facebook Open Graph, Twitter...

Hi torvista,
I looked at your page and say you had actually updated your plugin in 2020. As I wrote, I installed yours on 9th May 2019. So I am missing the two below updates you made post that date:

2020 03 27 - torvista Added the option of creating an anonymous, blank review with an admin-defined star-rating for products with no review at all, in an attempt to stop hundreds of warnings: Missing field "aggregateRating" Missing field "review" Remains to be seen if results in further warnings. 2020 02 25 - torvista changed array declarations to short syntax changed while to a foreach 2020 02 11 - torvista fixed double encoding ampersands. general revision for strict mode/EA inspection recommendations 2019 06 18 - torvista for php notices: facebook reviews code to only run on a product page. 2019 05 08 - torvista added schema: priceValidUntil Used last day of the year. added schema: SKU sku, mpn, ProductID all use the same products_model. Misc Moved fields around to mirror Google Structured Data Tool example. Edited the layout spacing for better visual presentation.

Bugfix Improved cleaning of product description for schema (line feeds, carriage returns, extra spaces). meta property="og:description" was always using Meta Tag description instead of category description when defined.
I will try to install the newest code and test again.

4 May 2020, 1:23 PM
#66
gernot avatar

gernot

Zen Follower

Join Date:
Feb 2017
Location:
Tokyo, Japan
Posts:
334
Plugin Contributions:
0

Re: Structured Data Markup for Schema, Facebook Open Graph, Twitter...

Ah, unfortunately no change with the new jscript_plugin_structured_data.php, which is the only file that appears to have changed, according to my diff between 9 May 2019 and 4 May 2020 downloads.

4 May 2020, 1:59 PM
#67
gernot avatar

gernot

Zen Follower

Join Date:
Feb 2017
Location:
Tokyo, Japan
Posts:
334
Plugin Contributions:
0

Re: Structured Data Markup for Schema, Facebook Open Graph, Twitter...

I might as well send you the entire current JSON content for the example product page.
By default it displays in Japanese, so you can see what UTF-8 characters end up escaped to character codes.

Notes:

  1. schemaOrganisation seems fine, just takes the direct input from Admin screen settings, which in my case is Japanese in UTF-8.
  2. schemaBreadcrumb, schemaProduct, seems to escape the original Zen Cart Japanese in UTF-8 to ASCII, so no UTF-8 characters, as well as URI-encoding.
  3. Facebook and Twitter properties seem to keep the original Zen Cart Japanese in UTF-8 just fine.
  4. Google schema url, and the Facebook, Twitter product property URLs are all missing the category ("cPath") part.
  5. However, both Google and Twitter find the product page in the debugger, even though the JSON URL is wrong! Facebook however does not.

https://www.proteawines.jp/shop/index.php?main_page=product_info&cPath=82&products_id=188

<script title="Structured Data: schemaOrganisation" type="application/ld+json">
{
     "@context": "http://schema.org",
        "@type": "Organization",
          "url": "https://www.proteawines.jp",
         "logo": "https://www.proteawines.jp/img/webshop/schemaLogo.jpg",
"contactPoint" : [{
            "@type" : "ContactPoint",
        "telephone" : "090-1616-1493",
      "contactType" : "customer service",
"availableLanguage" : "japanese,english"
                  }],
      "sameAs" : ["https://www.facebook.com/proteawinesjapan/",
"https://twitter.com/AkiHassenpflug",
"https://www.proteawines.jp/shop/index.php?main_page=contact_us"
                 ],
   "legalName" : "Protea Wines Japan",
       "email" : "southafrica.wines.japan######################",
      "address": {
            "@type": "PostalAddress",
   "streetAddress" : "牟礼2-11-24-304",
  "addressLocality": "三鷹市",
    "addressRegion": "東京都",
       "postalCode": "181-0002",
  "addressCountry" : "JP"
                 }
}
</script>
<script title="Structured Data: schemaBreadcrumb" type="application/ld+json">
{
       "@context": "http://schema.org",
          "@type": "BreadcrumbList",
"itemListElement": [
      {
      "@type": "ListItem",
   "position": 1,
       "item": {
           "@id": "https://www.proteawines.jp/shop/index.php?main_page=index",
          "name": "\u30db\u30fc\u30e0"
               }
       },
      {
      "@type": "ListItem",
   "position": 2,
       "item": {
           "@id": "https://www.proteawines.jp/shop/index.php?main_page=index&cPath=82",
          "name": "\u30d5\u30a9\u30fc\u30eb\u30b9\u30d9\u30a4\u30f4\u30a3\u30f3\u30e4\u30fc\u30c9"
               }
       },
      {
      "@type": "ListItem",
   "position": 3,
       "item": {
           "@id": "https://www.proteawines.jp/shop/index.php?main_page=product_info&cPath=82&products_id=188",
          "name": "\u30d5\u30a9\u30fc\u30eb\u30b9\u30d9\u30a4 \u3000\u30aa\u30fc\u30eb\u30c9\u30b9\u30af\u30fc\u30eb\u3000\u30b7\u30e9\u30fc 2017"
               }
       }
                    ]
}
</script>
<script title="Structured Data: schemaProduct" type="application/ld+json">
{   "@context": "https://schema.org",
      "@type": "Product",
       "name": "\u30d5\u30a9\u30fc\u30eb\u30b9\u30d9\u30a4 \u3000\u30aa\u30fc\u30eb\u30c9\u30b9\u30af\u30fc\u30eb\u3000\u30b7\u30e9\u30fc 2017",
      "image": "https://www.proteawines.jp/shop/images/false_bay/False-Bay-Vineyards-Old-School-Syrah-2017.jpg",
"description": "\u30d8\u30eb\u30c0\u30fc\u30d0\u30fc\u30b0\u8fd1\u304f\u306e\u30d0\u30a4\u30aa\u30c0\u30a4\u30ca\u30df\u30c3\u30af\u8fb2\u696d\u3092\u884c\u3063\u3066\u3044\u308b\u30a6\u30a9\u30fc\u30bf\u30fc\u30af\u30eb\u30fc\u30d5\u30ef\u30a4\u30ca\u30ea\u30fc\u306b\u62e0\u70b9\u3092\u7f6e\u304fFalse Bay Vineyards\u306e\u30d5\u30a9\u30fc\u30eb\u30b9\u30d9\u30a4\u30ec\u30f3\u30b8\u3002\u3053\u306e\u30d6\u30e9\u30f3\u30c9\u306f\u3001\u300c\u672c\u7269\u306e\u30ef\u30a4\u30f3 \u300d \u3092\u624b\u3054\u308d\u306a\u4fa1\u683c\u306b\u3057\u305f\u3044\u3068\u3044\u3046\u9858\u671b\u304b\u3089\u751f\u307e\u308c\u307e\u3057\u305f\u3002 \u91ce\u751f\u306e\u9175\u6bcd\u767a\u9175\u3001\u9178\u6dfb\u52a0\u306a\u3057…\u3053\u306e\u30d6\u30e9\u30f3\u30c9\u3067\u306f\u3001\u307e\u3055\u306b\u3053\u306e\u7279\u5fb4\u3092\u4eba\u9593\u306e\u624b\u3067\u3054\u307e\u304b\u3055\u305a\u306b\u3067\u304d\u308b\u304b\u304e\u308a\u30d4\u30e5\u30a2\u306b\u8868\u3057\u307e\u3059\u3002\u8461\u8404\u304c\u53e4\u3044\u3068\u3001\u81ea\u7136\u3068\u5730\u57df\u306b\u5408\u3046\u30d0\u30e9\u30f3\u30b9\u306e\u53d6\u308c\u305f\u91ce\u751f\u9175\u6bcd\u304c\u65e2\u306b\u3042\u308b\u306e\u3067\u3001\u81ea\u7136\u306e\u9175\u6bcd\u3068\u3001\u30aa\u30fc\u30ac\u30cb\u30c3\u30af\u3068\u30d0\u30a4\u30aa\u30c0\u30a4\u30ca\u30df\u30c3\u30af\u306e\u8fb2\u696d\u306e\u3084\u308a\u65b9\u3067\u305d\u306e\u571f\u5730\u306e\u8461\u8404\u306e\u3001\u81ea\u7136\u306e\u500b\u6027\u3092\u30ef\u30a4\u30f3\u3067\u8868\u73fe\u3057\u307e\u3059\u3002\u4eca\u65e5\u3067\u3082\u3001\u3053\u306e\u3088\u3046\u306a\u4fa1\u683c\u6c34\u6e96\u3067\u30ef\u30a4\u30f3\u3092\u88fd\u9020\u3059\u308b\u3053\u3068\u306f\u307b\u3068\u3093\u3069\u524d\u4f8b\u306e\u306a\u3044\u3053\u3068\u3067\u3059\u3002\u6728\u82fa\u3001\u30ab\u30b7\u30b9\u3001\u30d6\u30e9\u30c3\u30af\u30c1\u30a7\u30ea\u30fc\u306e\u4e0a\u54c1\u306a\u9999\u308a\u3002\u7a4f\u3084\u304b\u306a\u6e0b\u307f\u3068\u82b3\u9187\u306a\u9577\u3044\u4f59\u97fb\u3002\u304a\u8089\u6599\u7406\u3001\u30ab\u30ec\u30fc\u3001\u30c8\u30de\u30c8\u6599\u7406\u3001\u30d3\u30fc\u30d5\u30b7\u30c1\u30e5\u30fc\u306a\u3069\u306b\u3002\u5730\u57df\u8a73\u7d30\uff1a\u751f\u7523\u5730\uff1a\u5357\u30a2\u30d5\u30ea\u30ab\u53ce\u7a6b\u5730\uff1a\u30b9\u30c6\u30ec\u30f3\u30dc\u30c3\u30b7\u30e5\u5730\u533a\u5546\u54c1\u306e\u8a73\u7d30\uff1a\u54c1\u7a2e\uff1a\u30b7\u30e9\u30fc 100\uff05\u30d3\u30f3\u30c6\u30fc\u30b8\uff1a2017\u5e74\u30a2\u30eb\u30b3\u30fc\u30eb\u5ea6\u6570\uff1a13.63\uff05\u6b8b\u7cd6\u5ea6\uff1a2.6 g\/l\u6ef4\u5b9a\u9178\u5ea6\uff1a5.8 g\/l\u9178\u5ea6\uff1a3.57\u5473\uff1a\u8f9b\u53e3\u30dc\u30c7\u30a3\uff1a\u30d5\u30eb\u30d1\u30f3\u30d5\u30ec\u30c3\u30c8\u3068\u30c6\u30fc\u30b9\u30c6\u30a3\u30f3\u30b0\u30ce\u30fc\u30c8\uff1aPDF\u30d5\u30a1\u30a4\u30eb",
        "sku": "FBV0006",
        "mpn": "FBV0006",
      "brand": "False Bay Vineyards",
  "productID": "FBV0006",
     "offers": {
                "@type" : "Offer",
                   "url": "https://www.proteawines.jp/shop/index.php?main_page=product_info&products_id=188",
        "priceCurrency" : "JPY",
                "price" : "1309",
      "priceValidUntil" : "2020-12-31",
        "itemCondition" : "http://schema.org/NewCondition",
         "availability" : "http://schema.org/InStock",
               "seller" : "Protea Wines Japan",
     "deliveryLeadTime" : "1",
             "category" : "\u30d5\u30a9\u30fc\u30eb\u30b9\u30d9\u30a4\u30f4\u30a3\u30f3\u30e4\u30fc\u30c9",
          "itemOffered" : "\u30d5\u30a9\u30fc\u30eb\u30b9\u30d9\u30a4 \u3000\u30aa\u30fc\u30eb\u30c9\u30b9\u30af\u30fc\u30eb\u3000\u30b7\u30e9\u30fc 2017",
       "eligibleRegion" : "JP",
"acceptedPaymentMethod" : {
                  "@type" : "PaymentMethod",
                   "name" : ["http://purl.org/goodrelations/v1#ByBankTransferInAdvance",
"http://purl.org/goodrelations/v1#ByInvoice",
"http://purl.org/goodrelations/v1#Cash",
"http://purl.org/goodrelations/v1#CheckInAdvance",
"http://purl.org/goodrelations/v1#COD",
"http://purl.org/goodrelations/v1#DirectDebit",
"http://purl.org/goodrelations/v1#GoogleCheckout",
"http://purl.org/goodrelations/v1#PayPal",
"http://purl.org/goodrelations/v1#PaySwarm",
"http://purl.org/goodrelations/v1#AmericanExpress",
"http://purl.org/goodrelations/v1#DinersClub",
"http://purl.org/goodrelations/v1#Discover",
"http://purl.org/goodrelations/v1#JCB",
"http://purl.org/goodrelations/v1#MasterCard",
"http://purl.org/goodrelations/v1#VISA"]
                          }
               }
}
</script>
<!-- Facebook structured data general-->
<meta property="fb:app_id" content="879695509096293" />
<meta property="fb:admins" content="https://www.facebook.com/akika0803" />
<meta property="og:title" content="Protea Wines Japan - フォールスベイ  オールドスクール シラー 2017" />
<meta property="og:site_name" content="Protea Wines Japan" />
<meta property="og:url" content="https://www.proteawines.jp/shop/index.php?main_page=product_info&products_id=188" />
<meta property="og:locale" content="" />
<meta property="og:locale:alternate" content="" />
<meta property="og:image" content="https://www.proteawines.jp/shop/images/false_bay/False-Bay-Vineyards-Old-School-Syrah-2017.jpg" />
<meta property="og:image:url" content="https://www.proteawines.jp/shop/images/false_bay/False-Bay-Vineyards-Old-School-Syrah-2017.jpg" />
<meta property="og:image:type" content="image/jpeg" />
<meta property="og:image:width" content="800" />
<meta property="og:image:height" content="800" />
<meta property="og:description" content="ヘルダーバーグ近くのバイオダイナミック農業を行っているウォータークルーフワイナリーに拠点を置くFalse Bay Vineyardsのフォールスベイレンジ。このブランドは、「本物のワイン 」 を手ごろな価格にしたいという願望から生まれました。 野生の酵母発酵、酸添加なし…このブランドでは、まさにこの特徴を人間の手でごまかさずにできるかぎりピュアに表します。葡萄が古いと、自然と地域に合うバランスの取れた野生酵母が既にあるので、自然の酵母と、オーガニックとバイオダイナミックの農業のやり方でその土地の葡萄の、自然の個性をワインで表現します。今日でも、このような価格水準でワインを製造することはほとんど前例のないことです。木苺、カシス、ブラックチェリーの上品な香り。穏やかな渋みと芳醇な長い余韻。お肉料理、カレー、トマト料理、ビーフシチューなどに。地域詳細:生産地:南アフリカ収穫地:ステレンボッシュ地区商品の詳細:品種:シラー 100%ビンテージ:2017年アルコール度数:13.63%残糖度:2.6 g/l滴定酸度:5.8 g/l酸度:3.57味:辛口ボディ:フルパンフレットとテースティングノート:PDFファイル" />
    <!-- Facebook structured data for product-->
<meta property="og:type" content="og:product" />
<meta property="product:availability" content="instock" />
<meta property="product:brand" content="False Bay Vineyards" />
<meta property="product:category" content="フォールスベイヴィンヤード" />
<meta property="product:condition" content="new" />
<meta property="product:mfr_part_no" content="FBV0006" />
<meta property="product:price:amount" content="1309" />
<meta property="product:price:currency" content="JPY" />
<meta property="product:product_link" content="https://www.proteawines.jp/shop/index.php?main_page=product_info&products_id=188" />
<meta property="product:retailer" content="879695509096293" />
<meta property="product:retailer_category" content="フォールスベイヴィンヤード" />
<meta property="product:retailer_part_no" content="FBV0006" />
<!-- eof Facebook structured data -->
<!-- Twitter Card markup -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@AkiHassenpflug" />
<meta name="twitter:title" content="Protea Wines Japan - フォールスベイ  オールドスクール シラー 2017" />
<meta name="twitter:description" content="ヘルダーバーグ近くのバイオダイナミック農業を行っているウォータークルーフワイナリーに拠点を置くFalse Bay Vineyardsのフォールスベイレンジ。このブランドは、「本物のワイン 」 を手ごろな価格にしたいという願望から生まれました。 野生の酵母発酵、酸添加なし…このブランドでは、まさにこの特徴を人間の手でごまかさずにできるかぎりピュアに表します。葡萄が古いと、自然と地域に合うバランスの取れた野生酵母が既にあるので、自然の酵母と、オーガニックとバイオダイナミックの農業のやり方でその土地の葡萄の、自然の個性をワインで表現します。今日でも、このような価格水準でワインを製造することはほとんど前例のないことです。木苺、カシス、ブラックチェリーの上品な香り。穏やかな渋みと芳醇な長い余韻。お肉料理、カレー、トマト料理、ビーフシチューなどに。地域詳細:生産地:南アフリカ収穫地:ステレンボッシュ地区商品の詳細:品種:シラー 100%ビンテージ:2017年アルコール度数:13.63%残糖度:2.6 g/l滴定酸度:5.8 g/l酸度:3.57味:辛口ボディ:フルパンフレットとテースティングノート:PDFファイル" />
<meta name="twitter:image" content="https://www.proteawines.jp/shop/images/false_bay/False-Bay-Vineyards-Old-School-Syrah-2017.jpg" />
<meta name="twitter:image:alt" content="フォールスベイ  オールドスクール シラー 2017" />
<meta name="twitter:url" content="https://www.proteawines.jp/shop/index.php?main_page=product_info&amp;products_id=188" />
<meta name="twitter:domain" content="https://www.proteawines.jp" />
<!-- eof Twitter Card markup -->
5 May 2020, 6:39 AM
#68
gernot avatar

gernot

Zen Follower

Join Date:
Feb 2017
Location:
Tokyo, Japan
Posts:
334
Plugin Contributions:
0

Re: Structured Data Markup for Schema, Facebook Open Graph, Twitter...

Hi torvista,
I did some more checks, and unfortunately it looks like the problem lies in the htmlentities() function acting on $canonicalLink.
According to
https://www.zen-cart.com/showthread.php?220542-canonicalLink-not-working-on
$canonicalLink is defined in
/includes/init_includes/init_canonical.php
and output in
/includes/templates/<MYTEMPLATE>/common/html_header.php
The definition file includes the following:

/ cPath is excluded by default
 $includeCPath = FALSE;

That being the default, it explains why the URL excludes the cPath element.
I also found the explanation of why cPath is not included in the original announcement of init_canonical.php:
https://www.zen-cart.com/showthread.php?153191-What-do-the-upgrade-docs-mean-by-Canonical-URL-Support

But worrisome is that the resulting URL generated by the plugin is invalid, even in my browser.
So I checked:

  1. For categories there is no problem.
    Original URL:
    https://www.proteawines.jp/shop/index.php?main_page=index&cPath=82
    Plugin-generated version also works:
    https://www.proteawines.jp/shop/index.php?main_page=index&cPath=82

  2. For products, there is a problem.
    Original URL:
    https://www.proteawines.jp/shop/index.php?main_page=product_info&cPath=82&products_id=188
    Stripping out cPath manual to give canonical URL, still works:
    https://www.proteawines.jp/shop/index.php?main_page=product_info&products_id=188
    But the plugin-generated version does not work:
    https://www.proteawines.jp/shop/index.php?main_page=product_info&products_id=188

So "&" converted to "&" for categories works, but not so for products. Very odd!
I also re-iterate that while my browser (Firefox) and Facebook's debugger cannot handle this generated URL, Google and Twitter were able to somehow make sense of it in their debuggers and show the correct product preview.

5 May 2020, 6:58 AM
#69
gernot avatar

gernot

Zen Follower

Join Date:
Feb 2017
Location:
Tokyo, Japan
Posts:
334
Plugin Contributions:
0

Re: Structured Data Markup for Schema, Facebook Open Graph, Twitter...

Hi torvista,
My eyes are deceiving me... htmlentities() is only used for the Twitter URL, not for the others.
Still, none of them work in my browser with the "&" or with "&" (htmlentities() merely encodes the "&" again for Twitter).

5 May 2020, 10:13 AM
#70
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Structured Data Markup for Schema, Facebook Open Graph, Twitter...

gernot:

Hi torvista,
My eyes are deceiving me... htmlentities() is only used for the Twitter URL, not for the others.
Still, none of them work in my browser with the "&" or with "&" (htmlentities() merely encodes the "&" again for Twitter).
Gernot,
What about if you add the following file to your site:
includes/extra_configures/patch_clean_ampersands.php
to have the contents of that file as found at: https://raw.githubusercontent.com/zencart/zencart/v157/includes/extra_configures/patch_clean_ampersands.php

<?php
/*
 * Patch GET 20191111
 * 
 * @package initSystem
 * @copyright Copyright 2003-2020 Zen Cart Development Team
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: patch_clean_ampersands.php New in v1.5.7 $
 */
/**
 * Suitable for versions of Zen Cart prior to v1.5.7
 *
 * Non-sanitization/access - $_GET
 *
 * Please Note : This file should be placed in includes/extra_configures and will automatically load.
 *  
 */

if (!isset($_GET)) {
    return;
}
if (!is_array($_GET)) {
    return;
}
foreach ($_GET as $key => $value) {
    if ($key === 'amp;') continue;
    if (strpos($key, 'amp;') !== 0) {
        continue;
    }
    $newtext = substr($key, 4);
    if (isset($_GET[$newtext])) continue;

    $_GET[$newtext] = $_GET['amp;' . $newtext];
    unset($_GET['amp;' . $newtext]);
}

Does that resolve the issue of not being able to reach the page associated with ```
&

5 May 2020, 12:15 PM
#71
gernot avatar

gernot

Zen Follower

Join Date:
Feb 2017
Location:
Tokyo, Japan
Posts:
334
Plugin Contributions:
0

Re: Structured Data Markup for Schema, Facebook Open Graph, Twitter...

Hi mc12345678
Yes, the file made a difference!
$canonicalLink is still the same, but when I try to access the relative link at the top of a Zen Cart page I can do so. So that is a success

However, it only works when there is a single "&".

It does not work when there is a "&" which in the Structured Data plugin is for the Twitter Card URL, which further encodes with htmlentites($canonicalLink).

5 May 2020, 12:43 PM
#72
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Structured Data Markup for Schema, Facebook Open Graph, Twitter...

gernot:

Hi mc12345678
Yes, the file made a difference!
$canonicalLink is still the same, but when I try to access the relative link at the top of a Zen Cart page I can do so. So that is a success

However, it only works when there is a single "&".

It does not work when there is a "&" which in the Structured Data plugin is for the Twitter Card URL, which further encodes with htmlentites($canonicalLink).
Does FB still provide 404 response with the file or did that get resolved? Some of the other issues are actually in discussion (at least the issue with a products page being /index.php?products_id=xxx). I can provide what I also think is the solution to that issue as proposed by another zenner whose name I forget at the moment but I remember a few of those that were involved in the last couple of days.

5 May 2020, 12:50 PM
#73
gernot avatar

gernot

Zen Follower

Join Date:
Feb 2017
Location:
Tokyo, Japan
Posts:
334
Plugin Contributions:
0

Re: Structured Data Markup for Schema, Facebook Open Graph, Twitter...

Hi mc12345678,

Facebook debugger now finds the page perfectly! Response 200, and all content seems to be fine.

I notice that in the Structured Data plugin, only the Twitter card does a further encoding, as follows:

 <meta name="twitter:image:alt" content="<?php echo htmlentities($image_alt, ENT_QUOTES, 'UTF-8'); ?>" />
 <meta name="twitter:url" content="<?php echo htmlentities($canonicalLink); ?>" />
```I expect there was a reason for that so I am not going to remove it right now (and Twitter seems to find my page even with the broken encoding).
5 May 2020, 1:06 PM
#74
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Structured Data Markup for Schema, Facebook Open Graph, Twitter...

I'd question why the data fed to the twitter card was already encoded with htmlentities and then encoded a second time; however, may be able to change the command to:

htmlentities($variable, ENT_COMPAT, CHARSET, false)
``` adding the ", false" at the end so that it doesn't double encode and cause the ```
&amp;
``` situation...  The intent of the false is to not encode content to an htmlentity if it is already encoded.  The default though (which is used here) is to encode everything even if it is already encoded...

As for my use of CHARSET above, well ideally that is already set to 'UTF-8'; however, what it does is to ensure that the conversion is to the format supported by the site (current language/character set of the site/language pack).
5 May 2020, 1:26 PM
#75
gernot avatar

gernot

Zen Follower

Join Date:
Feb 2017
Location:
Tokyo, Japan
Posts:
334
Plugin Contributions:
0

Re: Structured Data Markup for Schema, Facebook Open Graph, Twitter...

Hi mc12345678
Thanks, I changed the existing to :

 <meta name="twitter:image:alt" content="<?php echo htmlentities($image_alt, ENT_QUOTES, 'UTF-8', false); ?>" />
 <meta name="twitter:url" content="<?php echo htmlentities($canonicalLink, ENT_COMPAT, CHARSET, false); ?>" />

for now. Perfect! Source code now shows only a single "&" in the URL, and Twitter shows the card fine (as before, mind you).
The alternative image content I added "false" for good measure, not sure if that encoding definition is perfect or not.

BTW, doing a regular trawl of the forums again today I came across a related issue here, with encoding of "&":
https://www.zen-cart.com/showthread.php?220238-Problems-with-special-characters-in-my-Admin/page2

6 May 2020, 11:42 AM
#76
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,874
Plugin Contributions:
7

Re: Structured Data Markup for Schema, Facebook Open Graph, Twitter...

Sorry not been able to look at this yet....thanks for the continued investigation..

6 May 2020, 6:48 PM
#77
gernot avatar

gernot

Zen Follower

Join Date:
Feb 2017
Location:
Tokyo, Japan
Posts:
334
Plugin Contributions:
0

Re: Structured Data Markup for Schema, Facebook Open Graph, Twitter...

Probably useful to re-iterate here, that the Schema part (not Facebook or Twitter) for the product (not the direct constants for shop information) in Japanese are all \u...\u.... unicode characters. It looks like that encompasses all the parameters using json_encode().
Is that the intended effect, that (presumably) all non-ASCII UTF-8 characters become human-unreadable?
(Presumably there is nothing syntactically incorrect about the result, since it is merely a different form of the same characters, but not legible anymore by humans)

7 May 2020, 4:42 PM
#78
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,874
Plugin Contributions:
7

Re: Structured Data Markup for Schema, Facebook Open Graph, Twitter...

I've added this to the Github, thanks. Please check if there is anything else required.

8 May 2020, 3:36 PM
#79
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Structured Data Markup for Schema, Facebook Open Graph, Twitter...

Presumably such characters would get translated to a utf-8 readable format. Though how that is performed is possibly open for debate. Torvista commented that normally uses Ceon URI Mappings which I believe has some sort of translater associated with it to do that type of conversion at least for uris and possibly other input...

13 May 2020, 5:44 PM
#80
gernot avatar

gernot

Zen Follower

Join Date:
Feb 2017
Location:
Tokyo, Japan
Posts:
334
Plugin Contributions:
0

Re: Structured Data Markup for Schema, Facebook Open Graph, Twitter...

Hi mc12345678 and torvista
I'm totally cool with whatever you think is good as long as it works reliably for SEO purposes, even if I as a human can't read the characters myself. I was merely raising the issue since I am using a non-European language and it might have been something buggy that had not been discovered yet.