Jump to content

MODULE - Normal products as combination (ERROR)


Recommended Posts

Hello everyone,

I bought the module that you see on the topic. But by "contact the developer" its not working for now on prestashop addons page and i want your help here.The problem is with deleting one of the products in combination.

For example:

I have product where i link to this product 2 more, if i delete on of these 3 products in combination i get error and i can't even open the other products. I get this error message on debug mode:

 

Invalid product vars
at line 174 in file classes/Link.php

169.             if (is_array($product) && isset($product['id_product'])) {
170.                 $params['id'] = $product['id_product'];
171.             } elseif ((int) $product) {
172.                 $params['id'] = $product;
173.             } else {
174.                 throw new PrestaShopException('Invalid product vars');
175.             }
176.         } else {
177.             $params['id'] = $product->id;
178.         }
179. 

 

LinkCore->getProductLink - [line 34 - var/cache/dev/smarty/compile/classic/5b/ab/84/5bab8483e3fba71abaa974445826996e7a9d4624_2.file.combinations.tpl.php] - [7 Arguments]

29. $_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['pc_combs']->value, 'comb');
30. $_smarty_tpl->tpl_vars['comb']->do_else = true;
31. if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['comb']->value) {
32. $_smarty_tpl->tpl_vars['comb']->do_else = false;
33. ?>
34.             <?php $_smarty_tpl->_assignInScope('productLink', $_smarty_tpl->tpl_vars['link']->value->getProductLink($_smarty_tpl->tpl_vars['comb']->value->id,$_smarty_tpl->tpl_vars['comb']->value->link_rewrite,null,null,null,null,$_smarty_tpl->tpl_vars['comb']->value->cache_default_attribute));?>
35.             <a class="variant-url imgsel<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['comb']->value->id, ENT_QUOTES, 'UTF-8');?>
36.  <?php if ($_smarty_tpl->tpl_vars['comb']->value->id == $_smarty_tpl->tpl_vars['product']->value['id']) {?>selected<?php }?>"
37.                  href="<?php if ($_smarty_tpl->tpl_vars['comb']->value->id == $_smarty_tpl->tpl_vars['product']->value['id']) {?>#<?php } else {
38. echo htmlspecialchars($_smarty_tpl->tpl_vars['productLink']->value, ENT_QUOTES, 'UTF-8');
39. }?>">

 

content_6227d3462c4773_92914707 - [line 123 - vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php] - [1 Arguments]

118.             if ($_template->startRenderCallbacks) {
119.                 foreach ($_template->startRenderCallbacks as $callback) {
120.                     call_user_func($callback, $_template);
121.                 }
122.             }
123.             $unifunc($_template);
124.             foreach ($_template->endRenderCallbacks as $callback) {
125.                 call_user_func($callback, $_template);
126.             }
127.             $_template->isRenderingCache = false;
128.         } catch (Exception $e) {

 

Smarty_Template_Resource_Base->getRenderedTemplateCode - [line 114 - vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php] - [1 Arguments]

109.                 array_merge($_template->cached->file_dependency, $this->file_dependency);
110.         }
111.         if ($_template->source->handler->uncompiled) {
112.             $_template->source->handler->renderUncompiled($_template->source, $_template);
113.         } else {
114.             $this->getRenderedTemplateCode($_template);
115.         }
116.         if ($_template->caching && $this->has_nocache_code) {
117.             $_template->cached->hashes[ $this->nocache_hash ] = true;
118.         }
119.         if ($_template->smarty->debugging) {

 

Smarty_Template_Compiled->render - [line 216 - vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php] - [1 Arguments]

211.             $this->cached->render($this, $no_output_filter);
212.         } else {
213.             if (!isset($this->compiled) || $this->compiled->compile_id !== $this->compile_id) {
214.                 $this->loadCompiled(true);
215.             }
216.             $this->compiled->render($this);
217.         }
218.         // display or fetch
219.         if ($display) {
220.             if ($this->caching && $this->smarty->cache_modified_check) {
221.                 $this->smarty->ext->_cacheModify->cacheModifiedCheck(

 

Smarty_Internal_Template->render - [line 232 - vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php] - [2 Arguments]

227.                 ob_start();
228.                 $template->_mergeVars();
229.                 if (!empty(Smarty::$global_tpl_vars)) {
230.                     $template->tpl_vars = array_merge(Smarty::$global_tpl_vars, $template->tpl_vars);
231.                 }
232.                 $result = $template->render(false, $function);
233.                 $template->_cleanUp();
234.                 if ($saveVars) {
235.                     $template->tpl_vars = $savedTplVars;
236.                     $template->config_vars = $savedConfigVars;
237.                 } else {

 

Smarty_Internal_TemplateBase->_execute - [line 116 - vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php] - [5 Arguments]

111.      * @throws SmartyException
112.      * @return string rendered template output
113.      */
114.     public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null)
115.     {
116.         $result = $this->_execute($template, $cache_id, $compile_id, $parent, 0);
117.         return $result === null ? ob_get_clean() : $result;
118.     }
119. 
120.     /**
121.      * displays a Smarty template

 

Smarty_Internal_TemplateBase->fetch - [line 40 - classes/Smarty/SmartyDevTemplate.php] - [7 Arguments]

35.         } else {
36.             $tpl = $this->template_resource;
37.         }
38. 
39.         return "\n<!-- begin $tpl -->\n"
40.             . parent::fetch($template, $cache_id, $compile_id, $parent, $display, $merge_tpl_vars, $no_output_filter)
41.             . "\n<!-- end $tpl -->\n";
42.     }
43. }

SmartyDevTemplateCore->fetch - [line 2449 - classes/module/Module.php]

 

2444.             }
2445.             if ($compile_id === null) {
2446.                 $compile_id = $this->getDefaultCompileId();
2447.             }
2448. 
2449.             $result = $this->getCurrentSubTemplate($template, $cache_id, $compile_id)->fetch();
2450. 
2451.             if ($cache_id !== null) {
2452.                 Tools::restoreCacheSettings();
2453.             }
2454. 

 

ModuleCore->display - [line 212 - modules/productascombinations/productascombinations.php] - [2 Arguments]

207.                     'pc_combs' => $products,
208.                     'pc_image' => $pc->image,
209.                 )
210.             );
211. 
212.             return $this->display(__FILE__, 'views/templates/front/combinations.tpl');
213.         }
214.     }
215. 
216.     public function hookDisplayProductCombinations($params)
217.     {

 

ProductAsCombinations->hookDisplayProductAdditionalInfo - [line 997 - classes/Hook.php] - [1 Arguments]

992.         return $output;
993.     }
994. 
995.     public static function coreCallHook($module, $method, $params)
996.     {
997.         return $module->{$method}($params);
998.     }
999. 
1000.     public static function coreRenderWidget($module, $hook_name, $params)
1001.     {
1002.         $context = Context::getContext();

 

 

Here is the screenshot

error.png

Link to comment
Share on other sites

If i edit and save one of these products in combination the problem is goes but its too hard with 2000+ products to do this. Do you know how can i do this easily? I tried with "Prestools mass editing" module but doesn't help.

Thank you in advance.

Link to comment
Share on other sites

As this is a 3rd party module it's hard to support, you should get support from the module developer.

On 3/11/2022 at 10:07 PM, nightdemon said:

If i edit and save one of these products in combination the problem is goes but its too hard with 2000+ products to do this. Do you know how can i do this easily?

If you know what is changed on database level (e.g. compare two products after one is changed) you can do the same in a mass wa by SQL direcly on the database (risky, always take backups before)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...