136 lines
7.1 KiB
PHP
136 lines
7.1 KiB
PHP
<?php
|
|
/**
|
|
* Module Name: Perimeter / Length / Surface (Area) / Volume / Weight Calculator for Prestashop
|
|
*
|
|
* Module URI: Please contact with info@megventure.com
|
|
* Description: A utility to calculate quantity in perimeter, length, area, volume or weight units
|
|
* Version: 5.5.1
|
|
*
|
|
* @author MEG Venture <info@megventure.com>
|
|
* @copyright 2007-2021 MEG Venture
|
|
* @license For Prestashop--> http://opensource.org/licenses/osl-3.2.1.php Open Software License (OSL 3.2.1)
|
|
*
|
|
* This program is not a free software: you can't redistribute it and/or modify
|
|
* it. All rights reserved to MEG Venture.
|
|
*
|
|
* This copyright notice and licence should be retained in all modules based on this framework.
|
|
* This does not affect your rights to assert copyright over your own original work.
|
|
*/
|
|
|
|
class SquaremeterAdmin extends ObjectModel
|
|
{
|
|
/** @var string Name */
|
|
public $id_squaremeteradmin;
|
|
|
|
/** @var integer */
|
|
public $id_shop;
|
|
public $id_product;
|
|
|
|
/** @var string */
|
|
public $displaycalculator;
|
|
public $displaypicture;
|
|
public $calculationtype;
|
|
public $additionalquantity;
|
|
public $directinput;
|
|
public $displayquantity;
|
|
public $displayprice;
|
|
public $displayreserve;
|
|
public $unit_baseprice;
|
|
public $displaystartingprice;
|
|
public $displayextrafee;
|
|
public $displayextrafeeselect;
|
|
public $displaywaste;
|
|
public $displaywasteselect;
|
|
public $attselect;
|
|
public $conversion;
|
|
public $secconversionselect;
|
|
public $secconversion;
|
|
public $attribute;
|
|
public $minheight;
|
|
public $maxheight;
|
|
public $maxheightunit;
|
|
public $heightcheck;
|
|
public $step_height;
|
|
public $minwidth;
|
|
public $maxwidth;
|
|
public $maxwidthunit;
|
|
public $widthcheck;
|
|
public $step_width;
|
|
public $mindepth;
|
|
public $maxdepth;
|
|
public $maxdepthunit;
|
|
public $depthcheck;
|
|
public $step_depth;
|
|
public $minweight;
|
|
public $maxweight;
|
|
public $maxweightunit;
|
|
public $weightcheck;
|
|
public $conversionunit;
|
|
public $attributeunit;
|
|
public $step;
|
|
public $disableapplet;
|
|
public $allow_ordering_from_listing;
|
|
public $ratio;
|
|
|
|
public static $definition = array(
|
|
'table' => 'squaremeteradmin',
|
|
'primary' => 'id_squaremeteradmin',
|
|
'multilang' => false,
|
|
'fields' => array(
|
|
'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), /* Adding id_shop spoils 1.6 update*/
|
|
'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
|
|
'displaycalculator' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'displaypicture' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'calculationtype' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'additionalquantity' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'directinput' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'displayquantity' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'ratio' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'displayprice' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'displayreserve' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'unit_baseprice' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'displaystartingprice' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'displayextrafee' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'displayextrafeeselect' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'displaywaste' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'displaywasteselect' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'attselect' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'conversion' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'secconversionselect' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'secconversion' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'attribute' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'minheight' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'maxheight' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'maxheightunit' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'heightcheck' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'step_height' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'minwidth' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'maxwidth' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'maxwidthunit' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'widthcheck' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'step_width' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'mindepth' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'maxdepth' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'maxdepthunit' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'depthcheck' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'step_depth' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'minweight' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'maxweight' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'maxweightunit' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'weightcheck' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'conversionunit' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'attributeunit' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'step' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'disableapplet' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
'allow_ordering_from_listing' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
|
),
|
|
);
|
|
|
|
public static function loadByIdProduct($id_product, $id_shop)
|
|
{
|
|
$result = Db::getInstance()->getRow('SELECT * FROM `' . pSQL(_DB_PREFIX_) . 'squaremeteradmin` sample WHERE sample.`id_shop` = ' . (int) $id_shop . ' AND sample.`id_product` = ' . (int) $id_product);
|
|
|
|
return new SquaremeterAdmin($result['id_squaremeteradmin']);
|
|
}
|
|
}
|