Jump to content

How to create a module in Prestashop 1.7? With the connection of the second site


Recommended Posts

Works shop on Prestashop 1.7. I want to create a module to connect the product catalog. At the root of the site there is a catalog folder in it is index.php, its own database, there is a site in the site. I want to create a module through which it will be possible to go to the directory from the Prestashop main page, with the site header and footer being displayed from the Prestashop store, and the data from the catalog folder?

Link to comment
Share on other sites

The folder in the directory has a connection file. You may need to fix something?

<?if(!defined("CAT_PROLOG_INCLUDED") || CAT_PROLOG_INCLUDED!==true)die();

require($_SERVER["DOCUMENT_ROOT"].'/config/config.inc.php');



//Add to cart
if(defined('CAT_ADD_TO_CART') AND CAT_ADD_TO_CART){
	global $arCartPrice;
	if(is_array($arCartPrice)){
		if($arCartPrice['OPTIONS']['MINIMUM']>1){$QUANTITY=$arCartPrice['OPTIONS']['MINIMUM'];}else{$QUANTITY=1;}
		$DefaultCategory = 12;
		$DefaultTaxGroup = 0;
		$Price = $arCartPrice['PRICE_CONVERTED'];
		$Reference = $arCartPrice['ARTICLE'].' / '.$arCartPrice['BRAND'];

		//Presta init
		global $context;
		if(!$context){$context = Context::getContext();}
		$logged = $context->cookie->__get('logged');
		$id_cart = $context->cookie->__get('id_cart');
		$id_lang = $context->cookie->__get('id_lang');
		$id_guest = $context->cookie->__get('id_guest');
		$id_currency = $context->cookie->__get('id_currency');

		
                   
<?php


$_GET=Array();
$controller = new FrontController();

$tm=time();

$controller->init();

//echo 'init() '.(time()-$tm).' sec.<br>'; $tm=time();

//$controller->initContent();
//echo 'initContent() '.(time()-$tm).' sec.<br>'; $tm=time();

$controller->setMedia();


//$controller->initHeader();


$context->smarty->tpl_vars['page']->value['page_name'] = 'CATod';
$context->smarty->tpl_vars['page']->value['meta']['title'] = CAT_TITLE;
$context->smarty->tpl_vars['page']->value['meta']['description'] = CAT_DESCRIPTION;
$context->smarty->tpl_vars['page']->value['meta']['keywords'] = CAT_KEYWORDS;
$context->smarty->tpl_vars['page']->value['meta']['robots'] = '';

$controller->displayHeader();


ErShow();
echo $CATContent;

 

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...