Jump to content

EC1

Members
  • Posts

    5
  • Joined

  • Last visited

Profile Information

  • First Name
    Joel
  • Last Name
    Ljunggren

EC1's Achievements

Newbie

Newbie (1/14)

1

Reputation

  1. Solved! (Way easier than I could imagine) Just needed to change. extends \ModuleAdminController -> AdminProductsController and remove $this->display(); the display() function is called automatically when all the right parameters have been set. /* EXECUTION ORDER OF CONTROLLERS */ //__contruct(): Sets all the controller's member variables. //init(): Initializes the controller. //setMedia() or setMobileMedia(): Adds all JavaScript and CSS specifics to the page so that they can be combined, compressed and cached (see PrestaShop's CCC tool, in the back office "Performance" page, under the "Advanced preferences" menu). //postProcess(): Handles ajaxProcess. //initHeader(): Called before initContent(). //initContent(): Initializes the content. //initFooter(): Called after initContent(). //display() or displayAjax(): Displays the content. /* FINAL CODE */ class ExtendedAdminController extends \AdminProductsController { public function __construct() { parent::__construct(); } }
  2. Hi I'm developing a module for PS16+, Is it possible to extend the existing classes instead of overriding them? I would like to extend the \AdminProductsController, it should look exactly like the original but at the same time be completely at the mercy of my custom controller. Here is what I have: ExtendedAdminController is launched when the tab to my module is clicked. class ExtendedAdminController extends \ModuleAdminController { public function __construct() { parent::__construct(); $this->initController(); $products = new ExtendedProductList(); // DO STUFF WITH THE PRODUCTS, ADD TABS, REMOVE TABS, COLUMNS ETC. $products->display(); //THIS IS WHERE THE PROBLEM IS } } class ExtendedProductList extends \AdminProductsController { public function __construct() { parent::__construct(); } } $products->display(); gives me errors Undefined index: iso Notice: Undefined index: img_dir in... app_icon.png Alternatively: How do I create my own list of all the available products? Sincerely grateful for suggestions!
  3. That works for my application (but maybe not for others). Thank you!
  4. /** * Get an order by its cart id * * @param int $id_cart Cart id * @return array Order details */ public static function getOrderByCartId($id_cart) { $sql = 'SELECT `id_order` FROM `'._DB_PREFIX_.'orders` WHERE `id_cart` = '.(int)$id_cart .Shop::addSqlRestriction(); $result = Db::getInstance()->getRow($sql); return isset($result['id_order']) ? $result['id_order'] : false; } This will only return the id of the order. Depending on the intended use, either change the name to getOrderIdByCartId or change the function. Maybe... public static function getOrderByCartId($id_cart) { $order = new Order($id_cart); return isset($order->id) ? $order : false; } Thanks!
  5. Hi, I'm using Prestashop 1.6.1.3 in test mode. I wonder how can I set a virtual product to have an infinite quantity? I tried the obvious of setting the quantity to 0, but when the product was ordered the quantity showed as -1. I don't think it makes sense that a virtual product has a quantity to begin with (unless we are talking about tickets and maybe other things...). But for, let's say a massage service, a quantity just doesn't make sense. The only solution I can think of is to set the product quantity to a ridiculously high number eg. 999999 and hide the quantity at the frontend. Any other suggestions? Have I missed something? /EC1 -- Is this a bug or a feature?
×
×
  • Create New...