Jump to content

kaktus.m

Members
  • Posts

    8
  • Joined

  • Last visited

About kaktus.m

  • Birthday 12/29/2000

Contact Methods

Profile Information

  • Location
    Germany
  • First Name
    Max
  • Last Name
    Brennemann

Recent Profile Visitors

289 profile views

kaktus.m's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hello, I've modded the default product.tpl file so that I can load extra template files via ajax. After I've figured out how to access my module front controller through ajax, I have now a new error: mod_fcgid: stderr: PHP Fatal error: Uncaught --> Smarty: Unable to load template file 'ajax_load_attributes.tpl' I've alo tried to give the whole path to this function, but the error changes: smarty_internal_templatebase.php(157) : eval()'d code): failed to open stream: No such file or directory mod_fcgid: stderr: PHP Warning: array_slice() expects parameter 1 to be array, boolean given PrestaShopException.php on line 110 mod_fcgid: stderr: PHP Warning: Invalid argument supplied for foreach() PrestaShopException.php on line 114 My PHP code: class TestmodulLoadAjaxModuleFrontController extends ModuleFrontController { public function initContent() { $this->ajax = true; parent::initContent(); } public function displayAjax() { if($this->errors) die(Tools::json_encode(array('hasError' => true, 'errors' => $this->errors))); if(Tools::getValue('d')) { $this->product = new Product((int)Tools::getValue('d')); $this->assignAttributesGroups(); echo $this->context->smarty->fetch('ajax_load_attributes.tpl'); die(); } } } I've found this other thread about the ajax load tpl content topic, but there this error doesn't seem to appear: https://www.prestashop.com/forums/topic/462682-load-tpl-content-from-ajax-request/
  2. Hello, I've tried to execute a SELECT statement in my backoffice module to show the result in a html table. When I look on the backoffice page of the module this error occures: Notice: Trying to get property of non-object This is my code of the TabController: <?php class AdminKonfiguratorTabController extends ModuleAdminController { public function __construct() { parent::__construct(); } public function initContent() { $category_id = 15; $category = new Category($category_id); $products = $category->getProducts($this->context->language->id, 0, 0, null, null, false, true, false, 1, true, null, true); foreach($products as $product) { echo '<br>'; var_dump($product); } $sqlprod = 'SELECT prstshp_product_lang.`name`, prstshp_product_lang.`link_rewrite`, prstshp_product_lang.`id_product`, prstshp_category_product.`id_category`, prstshp_product_shop.`active` FROM `prstshp_product_lang` LEFT JOIN `prstshp_category_product` ON prstshp_product_lang.`id_product`= prstshp_category_product.`id_product` LEFT JOIN `prstshp_product_shop` ON prstshp_product_lang.`id_product`= prstshp_product_shop.`id_product` WHERE `id_lang` = 1 AND `id_category` = 15'; $prods = Db::getInstance()->ExecuteS($sqlprod); $query = 'SELECT * FROM mySQLTable'; $data = Db::getInstance()->ExecuteS($query); $this->context->smarty->assign('products', $prods); $this->context->smarty->assign('data', $data); $this->setTemplate('AdminKonfiguratorTab.tpl'); return parent::initContent(); } public function renderView() { return parent::renderView(); } } This is the code of the template file <p>Hello world!</p> <table> {foreach $data as $dat} <tr> <td>{$dat.cartID}</td> <td>{$dat.price}</td> <td>{$dat.attributeNumber}</td> <td>{$dat.id}</td> </tr> {/foreach} </table> {foreach $products as $product} <p>{$product.id_product}</p> {/foreach}
  3. Hello, I am trying to install multiple tabs to the Backoffice of Prestashop. The main tab with the id_parent = 0 appears in the database. The other tabs aren't even installed. Here is my code: In install() method of the module: // Install admin tab if (!$this->installTab('AdminKonfiguratorTab', 'Konfigurator', null, true) && !$this->installTab('AdminKonfiguratorTabOverview', 'Konfigurator Overview', 'AdminKonfiguratorTab') && !$this->installTab('AdminKonfiguratorTabOrders', 'Konfigurator Orders', 'AdminKonfiguratorTab')) return false; the installTab() function: public function installTab($class_name, $name, $parent, $parent_tab_isZero = false) { // Create new admin tab $tab = new Tab(); if($parent_tab_isZero) { $tab->id_parent = 0; } else { $tab->id_parent = (int)Tab::getIdFromClassName($parent); } $tab->name = array(); foreach (Language::getLanguages(true) as $lang) $tab->name[$lang['id_lang']] = $name; $tab->class_name = $class_name; $tab->module = $this->name; $tab->active = 1; return $tab->add(); }
  4. Hello everyone, I am trying to edit the image of one product in my shop dynamically. I want the personalized image to appear at the shopping cart, the product page and at the ordering process. Every cart id and every attribute can have a personalized image. The question is, which files do I have to edit? Do I have to work on the template or with an override of a controller? I just want to find the files and lines of code where the image is handled and put into the cart, product or the ordering process. Thanks for any help in advance!
  5. Hello everyone, I have made a module to create a customized product. By pressing the "add to cart" button a specific price is inserted into the "specific_price" table of the database. This price is also connected with the current cart-id which I get with this code: {$context = Context::getContext()} {if is_null($context->cart->id)} {$context->cart->add()} {/if} {$ggg = $context->cart->id} (The code is written in the tpl-file of the module) My problem is, that the first time you visit my page and customize your product and add it to the cart, you will get the product with the standard price. After reloading the page or adding a new customized product everything works fine. I think that there is just a little error in my code or something isn't updating correctly. Thanks for your help!!
×
×
  • Create New...