Jump to content
  • 0

og:image w blogu nie aktualizuje zdjęć


Arek Presta Forum

Question

Cześć  Dodaję sobie post na socjale o nowym wpisie na naszym sklepowym blogu ale już nie męczy dodawanie też osobnej grafiki dlatego chciałem coś z tym w końcu zrobić. Poszukałem informacji, doczytałem że chodzi o funkcję og:image której używa facebook. Produkty mają swoje zdjęcia ale blogi już nie, podpowiada się tylko fota z pierwszego wpisu w związku z tym potestowałem trochę i w efekcie końcowym dodałem w head.tpl  dopisek o treści: 

 <meta property="og:image" content="{$post.featured_image}" />

we fragmencie:

 {block name='head_open_graph'}
    <meta property="og:title" content="{$page.meta.title}" />
    <meta property="og:description" content="{$page.meta.description}" />
    <meta property="og:url" content="{$urls.current_url}" />
    <meta property="og:site_name" content="{$shop.name}" />
    <meta property="og:image" content="{$post.featured_image}" />   //TAK TU GO WSTAWIŁEM BO TAK MI SIĘ WYDAWAŁO ŻE BĘDZIE DOBRZE
    {if !isset($product) && $page.page_name != 'product'}<meta property="og:type" content="website" />{/if}
  {/block}  

No ale to nie zadziałało O_O

przykładowy wpis jaki chciałem podlinkować na fb to: https://nekoprint.pl/blog/styl-neko-moda-uliczna-jak-zaczac-co-nosic-neokot-b25.html

ale grafika wyświetla się z tego: https://nekoprint.pl/blog/toksyczne-trendy-dlaczego-warto-byc-swiadomym-konsumentem-b16.html

WHYYYYYYYY??? 

wyłysiałem już przez tą prestę, jeżeli macie jakieś doświadczenie w tym temacie albo coś dajcie znać.

--

dodam tylko że.. po wprowadzeniu zmiany.. tak też debugowałem na stronie fb devs tools

Edited by Arek Presta Forum
zaponiałem dopisać -_- (see edit history)
Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

no to fakt.. ale był w szablonie już więc wiesz... próbuję ogarnąć Pro Blog który też mam zainstalowany ale tam jest inna kwestia.. klikając na kategorię bloga inną niż defaultowo utworzona dostaję error 500 XD 

Fatal error: Uncaught Error: Cannot assign an empty string to a string offset in 
/modules/ybc_blog_free/classes/ybc_blog_free_category_class.php on line 77

Szczegóły:

#0 /modules/ybc_blog_free/controllers/front/blog.php(357): 
   Ybc_blog_free_category_class->__construct()

#1 /modules/ybc_blog_free/controllers/front/blog.php(268): 
   Ybc_blog_freeBlogModuleFrontController->getPosts()

#2 /classes/controller/Controller.php(319): 
   Ybc_blog_freeBlogModuleFrontController->initContent()

#3 /classes/Dispatcher.php(510): 
   ControllerCore->run()

#4 /index.php(28): 
   DispatcherCore->dispatch()

#5 {main}

Gdzie leży problem:
 

/modules/ybc_blog_free/classes/ybc_blog_free_category_class.php

Błąd w linii:

77: $temp[$lang['id_lang']] = '';

Oto kod pliku:

<?php
/**
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author    PrestaShop SA <[email protected]>
*  @copyright 2007-2016 PrestaShop SA
*  @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*  @version  Release: $Revision$
*  International Registered Trademark & Property of PrestaShop SA
*/

if (!defined('_PS_VERSION_'))
	exit;
class Ybc_blog_free_category_class extends ObjectModel
{
    public $id_category;
    public $title;
    public $description;
    public $meta_description;
    public $meta_keywords;
	public $enabled;
	public $url_alias;
	public $image;
    public $sort_order;
    public $datetime_added;
    public $datetime_modified;
    public $added_by;
    public $modified_by;
    public static $definition = array(
		'table' => 'ybc_blog_free_category',
		'primary' => 'id_category',
		'multilang' => true,
		'fields' => array(
			'enabled' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true),
            'sort_order' => array('type' => self::TYPE_INT),
            'added_by' => array('type' => self::TYPE_INT, 'validate' => 'isunsignedInt'),
            'modified_by' => array('type' => self::TYPE_INT, 'validate' => 'isunsignedInt'),
            'image' =>	array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'size' => 500),            
            'datetime_added' =>	array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'size' => 500),
            'datetime_modified' =>	array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'size' => 500),
            // Lang fields
            'url_alias' =>	array('type' => self::TYPE_STRING, 'lang' => true,'validate' => 'isCleanHtml', 'size' => 500, 'required' => false),
            'meta_description' => array('type' => self::TYPE_STRING, 'lang' => true,'validate' => 'isCleanHtml', 'size' => 700),
            'meta_keywords' => array('type' => self::TYPE_STRING, 'lang' => true,'validate' => 'isCleanHtml', 'size' => 700),            
			'title' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCleanHtml', 'required' => true, 'size' => 700),			
            'description' =>	array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml', 'size' => 900000),
            
        )
	);
    public	function __construct($id_item = null, $id_lang = null, $id_shop = null, Context $context = null)
	{
		parent::__construct($id_item, $id_lang, $id_shop);
        $languages = Language::getLanguages(false);        
        foreach($languages as $lang)
        {
            foreach(self::$definition['fields'] as $field => $params)
            {   
                $temp = $this->$field; 
                if(isset($params['lang']) && $params['lang'] && !isset($temp[$lang['id_lang']]))
                {                      
                    $temp[$lang['id_lang']] = '';                        
                }
                $this->$field = $temp;
            }
        }
        unset($context);
	}
}

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...