193 lines
5.6 KiB
PHP
Executable File
193 lines
5.6 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* GIFT CARD
|
|
*
|
|
* @category pricing_promotion
|
|
* @author Timactive - Romain DE VERA <support@timactive.com>
|
|
* @copyright Copyright (c) TIMACTIVE 2014 - Romain De Véra AI
|
|
* @version 1.0.0
|
|
* @license Commercial license
|
|
*
|
|
*************************************
|
|
** GIFT CARD *
|
|
** V 1.0.0 *
|
|
*************************************
|
|
* +
|
|
* + Languages: EN, FR
|
|
* + PS version: 1.5,1.6
|
|
*/
|
|
|
|
class Link extends LinkCore {
|
|
|
|
/**
|
|
* Create a link to a product
|
|
*
|
|
* @param mixed $product
|
|
* Product object (can be an ID product, but deprecated)
|
|
* @param string $alias
|
|
* @param string $ean13
|
|
* @param string $category
|
|
* @param int $id_lang
|
|
* @param int $id_shop
|
|
* (since 1.5.0) ID shop need to be used when we generate a product link for a product in a cart
|
|
* @param int $ipa
|
|
* ID product attribute
|
|
* @return string
|
|
*/
|
|
|
|
/**
|
|
* Create a link to a product
|
|
*
|
|
* @param mixed $product
|
|
* Product object (can be an ID product, but deprecated)
|
|
* @param string $alias
|
|
* @param string $ean13
|
|
* @param string $category
|
|
* @param int $id_lang
|
|
* @param int $id_shop
|
|
* (since 1.5.0) ID shop need to be used when we generate a product link for a product in a cart
|
|
* @param int $ipa
|
|
* ID product attribute
|
|
* @return string
|
|
*/
|
|
|
|
/**
|
|
* Create a link to a product
|
|
*
|
|
* @param mixed $product
|
|
* Product object (can be an ID product, but deprecated)
|
|
* @param string $alias
|
|
* @param string $ean13
|
|
* @param string $category
|
|
* @param int $id_lang
|
|
* @param int $id_shop
|
|
* (since 1.5.0) ID shop need to be used when we generate a product link for a product in a cart
|
|
* @param int $ipa
|
|
* ID product attribute
|
|
* @return string
|
|
*/
|
|
|
|
/**
|
|
* Create a link to a product
|
|
*
|
|
* @param mixed $product
|
|
* Product object (can be an ID product, but deprecated)
|
|
* @param string $alias
|
|
* @param string $ean13
|
|
* @param string $category
|
|
* @param int $id_lang
|
|
* @param int $id_shop
|
|
* (since 1.5.0) ID shop need to be used when we generate a product link for a product in a cart
|
|
* @param int $ipa
|
|
* ID product attribute
|
|
* @return string
|
|
*/
|
|
|
|
/**
|
|
* Create a link to a product
|
|
*
|
|
* @param mixed $product
|
|
* Product object (can be an ID product, but deprecated)
|
|
* @param string $alias
|
|
* @param string $ean13
|
|
* @param string $category
|
|
* @param int $id_lang
|
|
* @param int $id_shop
|
|
* (since 1.5.0) ID shop need to be used when we generate a product link for a product in a cart
|
|
* @param int $ipa
|
|
* ID product attribute
|
|
* @return string
|
|
*/
|
|
|
|
/**
|
|
* Create a link to a product
|
|
*
|
|
* @param mixed $product
|
|
* Product object (can be an ID product, but deprecated)
|
|
* @param string $alias
|
|
* @param string $ean13
|
|
* @param string $category
|
|
* @param int $id_lang
|
|
* @param int $id_shop
|
|
* (since 1.5.0) ID shop need to be used when we generate a product link for a product in a cart
|
|
* @param int $ipa
|
|
* ID product attribute
|
|
* @return string
|
|
*/
|
|
|
|
/**
|
|
* Create a link to a product
|
|
*
|
|
* @param mixed $product
|
|
* Product object (can be an ID product, but deprecated)
|
|
* @param string $alias
|
|
* @param string $ean13
|
|
* @param string $category
|
|
* @param int $id_lang
|
|
* @param int $id_shop
|
|
* (since 1.5.0) ID shop need to be used when we generate a product link for a product in a cart
|
|
* @param int $ipa
|
|
* ID product attribute
|
|
* @return string
|
|
*/
|
|
|
|
/**
|
|
* Create a link to a product
|
|
*
|
|
* @param mixed $product
|
|
* Product object (can be an ID product, but deprecated)
|
|
* @param string $alias
|
|
* @param string $ean13
|
|
* @param string $category
|
|
* @param int $id_lang
|
|
* @param int $id_shop
|
|
* (since 1.5.0) ID shop need to be used when we generate a product link for a product in a cart
|
|
* @param int $ipa
|
|
* ID product attribute
|
|
* @return string
|
|
*/
|
|
|
|
/**
|
|
* Create a link to a product
|
|
*
|
|
* @param mixed $product
|
|
* Product object (can be an ID product, but deprecated)
|
|
* @param string $alias
|
|
* @param string $ean13
|
|
* @param string $category
|
|
* @param int $id_lang
|
|
* @param int $id_shop
|
|
* (since 1.5.0) ID shop need to be used when we generate a product link for a product in a cart
|
|
* @param int $ipa
|
|
* ID product attribute
|
|
* @return string
|
|
*/
|
|
public function getProductLink($product, $alias = null, $category = null, $ean13 = null, $id_lang = null, $id_shop = null, $ipa = 0, $force_routes = false)
|
|
{
|
|
$giftcard = Module::getInstanceByName ( 'giftcard' );
|
|
if ($giftcard && $giftcard->active)
|
|
{
|
|
if (! is_object ( $product ))
|
|
{
|
|
if (is_array ( $product ) && isset ( $product['id_product'] ))
|
|
$id_product = $product['id_product'];
|
|
elseif ((int)$product)
|
|
$id_product = (int)$product;
|
|
}
|
|
else
|
|
$id_product = $product->id;
|
|
if ((int)$id_product > 0)
|
|
{
|
|
if ($giftcard->isGiftCard ( $id_product ))
|
|
{
|
|
$params = array ();
|
|
$params['id_product'] = $id_product;
|
|
return ($this->getModuleLink ( 'giftcard', 'choicegiftcard', $params ));
|
|
}
|
|
}
|
|
}
|
|
return (parent::getProductLink ( $product, $alias, $category, $ean13, $id_lang, $id_shop, $ipa, $force_routes ));
|
|
}
|
|
}
|
|
|