Files
wyczarujprezent.pl/modules/zakeke/classes/ZakekeConfiguratorItem.php
2024-10-28 22:14:22 +01:00

55 lines
1.7 KiB
PHP

<?php
/**
* Copyright (C) 2020 Futurenext srl
*
* This file is part of Zakeke.
*
* Zakeke Interactive Product Designer can not be copied and/or distributed
* without the express permission of Futurenext srl
*
* @author Futurenext srl <help@zakeke.com>
* @copyright 2019 Futurenext srl
* @license https://www.zakeke.com/privacy/#general_conditions
*/
class ZakekeConfiguratorItem extends ObjectModel
{
/** @var string Zakeke configurator item id */
public $id_configurator_item;
/** @var string Item preview url */
public $preview;
/** @var float Price for the configuration */
public $price = 0.0;
/** @var string JSON serialized list of chosen attributes */
public $items_json;
/**
* @see ObjectModel::$definition
*/
public static $definition = array(
'table' => 'zakeke_configurator_item',
'primary' => 'id_zakeke_configurator_item',
'fields' => array(
'id_configurator_item' => array('type' => self::TYPE_STRING, 'required' => true),
'preview' => array('type' => self::TYPE_STRING, 'required' => true),
'price' => array('type' => self::TYPE_FLOAT, 'required' => true),
'items_json' => array('type' => self::TYPE_STRING, 'required' => true)
)
);
public static function zakekeConfiguratorItemId($id_configurator_item)
{
if (strpos($id_configurator_item, '-') === false) {
return false;
}
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT `id_zakeke_configurator_item`
FROM ' . _DB_PREFIX_ . 'zakeke_configurator_item
WHERE `id_configurator_item` = "' . pSQL($id_configurator_item) . '"');
}
}