Last active
November 18, 2018 20:19
-
-
Save hh-com/1a47d5acc752563c3aa3711bb904f2e4 to your computer and use it in GitHub Desktop.
Prestashop: Get all Product- Links
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ini_set('display_errors',1); | |
ini_set('display_startup_errors',1); | |
error_reporting(-1); | |
require_once(dirname(__FILE__).'/../../config/config.inc.php'); | |
require_once(dirname(__FILE__).'/../../init.php'); | |
/*Cache-Control:*/ | |
header("Cache-Control: no-cache, must-revalidate"); //HTTP 1.1 | |
header("Pragma: no-cache"); //HTTP 1.0 | |
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past | |
/* | |
create a new module in /modules/helperGetAllLinks | |
run this script with http://www.example.com/modules/helperGetAllLinks/getAllProductLinks.php | |
*/ | |
function run() | |
{ | |
$id_lang = 1; | |
$productObj = new Product(); | |
$products = $productObj -> getProducts($id_lang, 0, 0, 'id_product', 'DESC' ); | |
foreach ($products as $row) | |
{ | |
$link = Context::getContext()->link->getProductLink($row,null,null,null,$id_lang,1); | |
echo $link . "<br>" ; | |
} | |
} | |
run(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment