Jump to content

Compatibility Biosany Responsive Germanext


cagoo
 Share

Recommended Posts

Hi,

 

I am using PrestaShop 1.5.6.2 with the Theme Biosany Responsive and have installed a Module that makes my shop according to german law called  „Germanext 1.5.6”. Every CSS-Editing worked, but

 

1. when clicking on a product an the home screen I get an error:
Warning: min() [function.min]: Array must contain at least one element in /var/www/web56/html/modules/germanext/gn_override/classes/Product.php on line 300

 

and 

 

2. all the Product-Pics on the K´Homescreen are blurred (although the size 250 x 250 px is the same as before.)

URL: www.vianaturale.de

Any help strongly appreciated!

Thomas

Edited by cagoo (see edit history)

Share this post


Link to post
Share on other sites

1) due to the fact that you use override - i have no idea what code you use there. Override is a custom code which changes prestashop core. source of custom code you can see there modules/germanext/gn_override/classes/Product.php on line 300

 

what code you use there?

 

2) natural size of your pictures is 210 x 210

and your theme uses 250x250

make sure that picture size under preferences > images tab (imagetype: "home") is 250x250

  • Like 1

Share this post


Link to post
Share on other sites

Hi Milos,

 

here's the code of the override Product.php:
 

<?php
class Product extends ProductCore
{
public $unit_net;
public $id_base_unit;
protected static $_carriers = null;
 
public function __construct($id_product = null, $full = false, $id_lang = null, $id_shop = null, Context $context = null) {
if ( ! array_key_exists('unit_net', self::$definition['fields'])) {
self::$definition['fields']['unit_net'] = array('type' => parent::TYPE_STRING, 'validate' => 'isString');
}
 
if ( ! array_key_exists('id_base_unit', self::$definition['fields'])) {
self::$definition['fields']['id_base_unit'] = array('type' => parent::TYPE_INT, 'validate' => 'isUnsignedId');
}
 
parent::__construct($id_product, $full, $id_lang, $id_shop, $context);
}
 
public function getFields() {
parent::validateFields();
 
$fields['unit_net'] = pSQL($this->unit_net);
$fields['id_base_unit'] = pSQL($this->id_base_unit);
        
return parent::getFields();
}
 
public function updateAttribute($id_product_attribute, $wholesale_price, $price, $weight, $unit, $ecotax, $id_images, $reference, $ean13, $default, $location = null, $upc = null, $minimal_quantity = null, $available_date = null, $update_all_fields = true, array $id_shop_list = array(), $net = 0) {
$combination = new Combination($id_product_attribute);
 
if ( ! $update_all_fields) {
$combination->setFieldsToUpdate(array(
'price'             => ! is_null($price),
'wholesale_price'   => ! is_null($wholesale_price),
'ecotax'            => ! is_null($ecotax),
'weight'            => ! is_null($weight),
'unit_price_impact' => ! is_null($unit),
'unit_net_impact'   => ! is_null($net),
'default_on'        => ! is_null($ecotax),
'minimal_quantity'  => ! is_null($minimal_quantity),
'available_date'    => ! is_null($available_date),
));
}
 
$price = str_replace(',', '.', $price);
$weight = str_replace(',', '.', $weight);
 
$combination->price             = (float)$price;
$combination->wholesale_price   = (float)$wholesale_price;
$combination->ecotax            = (float)$ecotax;
$combination->weight            = (float)$weight;
$combination->unit_price_impact = (float)$unit;
$combination->unit_net_impact   = (float)$net;
$combination->reference         = pSQL($reference);
$combination->location          = pSQL($location);
$combination->ean13             = pSQL($ean13);
$combination->upc               = pSQL($upc);
$combination->default_on        = (int)$default;
$combination->minimal_quantity  = (int)$minimal_quantity;
$combination->available_date    = $available_date ? pSQL($available_date) : '0000-00-00';
 
if (count($id_shop_list)) {
$combination->id_shop_list = $id_shop_list;
}
 
$combination->save();
 
if ( ! empty($id_images)) {
$combination->setImages($id_images);
}
 
Product::updateDefaultAttribute($this->id);
 
Hook::exec('actionProductAttributeUpdate', array('id_product_attribute' => $id_product_attribute));
 
return true;
}
    
public function addCombinationEntity($wholesale_price, $price, $weight, $unit_impact, $ecotax, $quantity, $id_images, $reference, $id_supplier, $ean13, $default, $location = null, $upc = null, $minimal_quantity = 1, array $id_shop_list = array(), $net_impact = 0) {
$id_product_attribute = $this->addAttribute(
$price,
$weight,
$unit_impact,
$ecotax,
$id_images,
$reference,
$ean13,
$default,
$location,
$upc,
$minimal_quantity,
$id_shop_list,
$net_impact
);
 
$this->addSupplierReference($id_supplier, $id_product_attribute);
$result = ObjectModel::updateMultishopTable('Combination', array(
'wholesale_price' => (float)$wholesale_price,
), 'a.id_product_attribute = '.(int)$id_product_attribute);
 
if ( ! $id_product_attribute || ! $result) {
return false;
}
 
if ($this->getType() == Product::PTYPE_VIRTUAL) {
StockAvailable::setProductOutOfStock((int)$this->id, 1, null, $id_product_attribute);
}
else {
StockAvailable::setProductOutOfStock((int)$this->id, StockAvailable::outOfStock($this->id), null, $id_product_attribute);
}
 
return $id_product_attribute;
}
    
public function addAttribute($price, $weight, $unit_impact, $ecotax, $id_images, $reference, $ean13, $default, $location = null, $upc = null, $minimal_quantity = 1, array $id_shop_list = array(), $net_impact = 0) {
if ( ! $this->id) {
return;
}
 
$price = str_replace(',', '.', $price);
$weight = str_replace(',', '.', $weight);
 
$combination = new Combination();
$combination->id_product = (int)$this->id;
$combination->price = (float)$price;
$combination->ecotax = (float)$ecotax;
$combination->quantity = 0;
$combination->weight = (float)$weight;
$combination->unit_price_impact = (float)$unit_impact;
$combination->unit_net_impact = (float)$net_impact;
$combination->reference = pSQL($reference);
$combination->location = pSQL($location);
$combination->ean13 = pSQL($ean13);
$combination->upc = pSQL($upc);
$combination->default_on = (int)$default;
$combination->minimal_quantity = (int)$minimal_quantity;
 
// if we add a combination for this shop and this product does not use the combination feature in other shop,
// we clone the default combination in every shop linked to this product
if ($default && !$this->hasAttributesInOtherShops()) {
$id_shop_list_array = Product::getShopsByProduct($this->id);
 
foreach ($id_shop_list_array as $array_shop) {
$id_shop_list[] = $array_shop['id_shop'];
}
 
$id_shop_list = array_unique($id_shop_list);
}
 
if (count($id_shop_list)) {
$combination->id_shop_list = array_unique($id_shop_list);
}
 
$combination->add();
 
if ( ! $combination->id) {
return false;
}
 
Product::updateDefaultAttribute($this->id);
 
if ( ! empty($id_images)) {
$combination->setImages($id_images);
}
 
return (int)$combination->id;
}
 
public function getAttributesGroups($id_lang) {
if ( ! Combination::isFeatureActive()) {
return array();
}
 
$sql = '
SELECT 
ag.`id_attribute_group`, 
ag.`is_color_group`, 
agl.`name` AS group_name, 
agl.`public_name` AS public_group_name,
a.`id_attribute`, 
al.`name` AS attribute_name, 
a.`color` AS attribute_color, 
pa.`id_product_attribute`,
IFNULL(stock.quantity, 0) as quantity, 
product_attribute_shop.`price`, 
product_attribute_shop.`ecotax`, 
pa.`weight`,
product_attribute_shop.`default_on`, 
pa.`reference`, 
product_attribute_shop.`unit_price_impact`, 
product_attribute_shop.`unit_net_impact`,
pa.`minimal_quantity`, 
pa.`available_date`, 
ag.`group_type`
FROM 
`'._DB_PREFIX_.'product_attribute` pa
'.Shop::addSqlAssociation('product_attribute', 'pa').'
'.Product::sqlStock('pa', 'pa').'
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON pac.`id_product_attribute` = pa.`id_product_attribute`
LEFT JOIN `'._DB_PREFIX_.'attribute` a ON a.`id_attribute` = pac.`id_attribute`
LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON ag.`id_attribute_group` = a.`id_attribute_group`
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON a.`id_attribute` = al.`id_attribute`
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON ag.`id_attribute_group` = agl.`id_attribute_group`
'.Shop::addSqlAssociation('attribute', 'a').'
WHERE 
pa.`id_product` = '.(int)$this->id.'
AND 
al.`id_lang` = '.(int)$id_lang.'
AND 
agl.`id_lang` = '.(int)$id_lang.'
GROUP BY 
id_attribute_group, id_product_attribute
ORDER BY 
ag.`position` ASC, a.`position` ASC';
 
return Db::getInstance()->executeS($sql);
}
 
public function getProductMinimalShippingPrice() {
$context = Context::getContext();
 
$price = self::getPriceStatic((int)$this->id, false, null, 6, null, false, true, 1, false, $context->cart->id_customer, $context->cart->id, null, $this->specificPrice);
$weight = (float)$this->weight;
$free_shipping_price = Configuration::get('PS_SHIPPING_FREE_PRICE');
$free_shipping_weight = Configuration::get('PS_SHIPPING_FREE_WEIGHT');
$handling_charge = (float)Configuration::get('PS_SHIPPING_HANDLING');
 
if ( ! $context->cart->isMultiAddressDelivery()
&& isset($context->cart->id_address_delivery)
&& $context->cart->id_address_delivery
&& Customer::customerHasAddress($context->cart->id_customer, $context->cart->id_address_delivery
))
$id_zone = Address::getZoneById((int)$context->cart->id_address_delivery);
else {
$default_country = new Country(Configuration::get('PS_COUNTRY_DEFAULT'), Configuration::get('PS_LANG_DEFAULT'));
 
$id_zone = (int)$default_country->id_zone;
}
 
if ((int)$context->cart->id_customer) {
$customer = new Customer((int)$context->cart->id_customer);
$result = Carrier::getCarriers((int)Configuration::get('PS_LANG_DEFAULT'), true, false, (int)$id_zone, $customer->getGroups());
unset($customer);
}
else {
$result = Carrier::getCarriers((int)Configuration::get('PS_LANG_DEFAULT'), true, false, (int)$id_zone);
}
 
$prices = array();
 
if ($free_shipping_price > 0 && $price >= $free_shipping_price) {
   return 0;
}
 
if ($free_shipping_weight > 0 && $weight >= $free_shipping_weight) {
   return 0;
}
 
foreach ($result as $k => $row) {
if ( ! isset(self::$_carriers[$row['id_carrier']])) {
self::$_carriers[$row['id_carrier']] = new Carrier((int)$row['id_carrier']);
}
 
$carrier = self::$_carriers[$row['id_carrier']];
 
if (($carrier->getShippingMethod() == Carrier::SHIPPING_METHOD_WEIGHT && $carrier->getMaxDeliveryPriceByWeight((int)$id_zone) === false)
|| ($carrier->getShippingMethod() == Carrier::SHIPPING_METHOD_PRICE && $carrier->getMaxDeliveryPriceByPrice((int)$id_zone) === false))
{
unset($result[$k]);
continue;
}
 
if ($row['range_behavior']) {
$check_delivery_price_by_weight = Carrier::checkDeliveryPriceByWeight($row['id_carrier'], $weight, (int)$id_zone);
$check_delivery_price_by_price = Carrier::checkDeliveryPriceByPrice($row['id_carrier'], $price, (int)$id_zone, (int)$context->cart->id_currency);
 
if (($carrier->getShippingMethod() == Carrier::SHIPPING_METHOD_WEIGHT && ! $check_delivery_price_by_weight)
|| ($carrier->getShippingMethod() == Carrier::SHIPPING_METHOD_PRICE && ! $check_delivery_price_by_price))
{
unset($result[$k]);
continue;
}
}
 
if ($carrier->getShippingMethod() == Carrier::SHIPPING_METHOD_WEIGHT) {
$shipping_price = $carrier->getDeliveryPriceByWeight($weight, (int)$id_zone);
}
else {
$shipping_price = $carrier->getDeliveryPriceByPrice($price, (int)$id_zone, (int)$context->cart->id_currency);
}
 
if ($carrier->shipping_handling) {
$shipping_price+= $handling_charge;
}
 
array_push($prices, $shipping_price);
}
 
return min($prices);
}
}
 
----------

Line 300 is the third last line..

Thanx a lot!

 

Share this post


Link to post
Share on other sites

  • 2 weeks later...
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More