Skip to content
This repository was archived by the owner on Jun 25, 2025. It is now read-only.

Commit 42f558b

Browse files
committed
First commit
0 parents  commit 42f558b

26 files changed

+2399
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.idea
2+
.DS_Store

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Apisearch Prestashop Plugin
2+
3+
### How to install in Prestashop
4+
5+
1. Download this source code and place it in a folder called 'apisearch'
6+
7+
2. Zip the new folder to a file called apisearch.zip (once you unzip this file, you should find all the source code inside the apisearch folder).
8+
9+
3. Upload the zip file under the modules section in Prestashop's backoffice
10+
11+
### How to configure
12+
13+
Once you've installed the plugin succesfully, it's time to configure.
14+
15+
1. Apisearch Cluster Url
16+
17+
This is the absolute url to the cluster you'll be pointing to.
18+
19+
* Note: If you leave it blank it'll point to the default Apisearch Production Cluster 'https://eu1.apisearch.cloud'
20+
21+
2. Apisearch Admin Url
22+
23+
This is the absolute url you'll be pulling the js files from.
24+
25+
* Note: If you leave it blank it'll point to the default Apisearch Production Admin 'https://apisearch.cloud'
26+
27+
3. Apisearch Api Version
28+
29+
This is the Api Version for the api calls.
30+
31+
* Note: If you leave it blank it'll point to the default Apisearch Production Version 'v1'
32+
33+
4. App Hash ID
34+
35+
Unique hash for your application
36+
37+
5. Index Hash ID
38+
39+
The index your items are indexed. Note that if you've got a multilingual store, you can set a different index per language.
40+
41+
6. Management token Hash ID
42+
43+
The secret token that will allow indexing your items.

ajax.php

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
3+
/**
4+
* 2007-2020 PrestaShop
5+
*
6+
* NOTICE OF LICENSE
7+
*
8+
* This source file is subject to the Academic Free License (AFL 3.0)
9+
* that is bundled with this package in the file LICENSE.txt.
10+
* It is also available through the world-wide-web at this URL:
11+
* http://opensource.org/licenses/afl-3.0.php
12+
* If you did not receive a copy of the license and are unable to
13+
* obtain it through the world-wide-web, please send an email
14+
* to license@prestashop.com so we can send you a copy immediately.
15+
*
16+
* DISCLAIMER
17+
*
18+
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
19+
* versions in the future. If you wish to customize PrestaShop for your
20+
* needs please refer to http://www.prestashop.com for more information.
21+
*
22+
* @author PrestaShop SA <contact@prestashop.com>
23+
* @copyright 2007-2020 PrestaShop SA
24+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25+
* International Registered Trademark & Property of PrestaShop SA
26+
*/
27+
require_once(dirname(__FILE__) . '../../../config/config.inc.php');
28+
require_once(dirname(__FILE__) . '../../../init.php');
29+
30+
if (Tools::getIsset('method') && Tools::getIsset('ajax')) {
31+
if (Tools::getValue('ajax') == true) {
32+
switch (Tools::getValue('method')) {
33+
case 'syncProducts':
34+
syncProducts();
35+
die(Tools::jsonEncode(true));
36+
}
37+
}
38+
}
39+
40+
function syncProducts()
41+
{
42+
require_once __DIR__ . '/model/exporter.php';
43+
require_once __DIR__ . '/model/builder.php';
44+
require_once __DIR__ . '/model/connection.php';
45+
require_once __DIR__ . '/apisearch.php';
46+
47+
$exporter = new Exporter(
48+
new Builder(),
49+
new Connection()
50+
);
51+
52+
$exporter->exportAll();
53+
}

0 commit comments

Comments
 (0)