Jump to content

Any prestashop guru around?


Sensi420
 Share

Recommended Posts

HelloLooking for some 1 with knowledge about making\editing a module.I have made my own flash carousel and i want to put it in a module.I was thinking of modefy the Home Featured Carousel and delete the carousel and add mine.I allsow want to make a simpler module than the homefeature module,i dont need to be able to add pictures via backoffice.I dont want to change pictures,and if i want someday then i will just make a new carousel.What i want to make is a module that can place swf files in the product categoire block.example:Apple---------------->when i click here ii want to add the swf file to the main categoire picture blockNintendo------------->playstation----------->Its about a total of 5 swf movies i want to place on my site.I hope any 1 can help me with this issue.....Ps if there should be a kind person to help me then i can provide alot more info like codes/scripts.Reason i dont do this now is,prestashop people dont like to explain a user how to do it themself.Have posted long posts and wasted alot of time to try to get help,and every time i get "just buy this module it does what you want"Regard Sensi

Edited by Sensi420
Link to comment
Share on other sites

PrestaShop is a professional e-Commerce shopping cart software(like magneto)It uses PHP,SQL.HTML.CSS.AJAX,JAVASCRIP,XML,SMARTY and alot of more things.The main problem is its using smarty.Its a easy to for beginners,but for people how want to modefy it more than possible with free modules its a real nightmare.My opinion is its the best but with the thinnest manual ever!!

Link to comment
Share on other sites

Reason i dont do this now is,prestashop people dont like to explain a user how to do it themself.Have posted long posts and wasted alot of time to try to get help,and every time i get "just buy this module it does what you want"
Sounds like CubeCart. Also like CubeCart, it looks like they don't have any developer documentation. If that's the case really the only way to learn how to do things like this, if the other users aren't going to help, is to learn how the software works and learn how the modules tie in to everything. You're probably looking for more information than that, but I've never used that software.
Link to comment
Share on other sites

Thanks for the reply.For those of you who have used PHP template engines, the basic concepts of Smarty should look quite familiar. In your PHP application you assign variables for use in the template, then you display it.and i think i need to understand PHP to understand Smarty. Im not that good in php yet,studying hard to try to learn it.Here i can give some codes on how a module php file looks like:this module adds a social bookmark block.

<?php/** MODULO CRIADO POR ODLANIER * @author Odlanier de Souza Mendes * @copyright Dlani * @email master_odlanier@hotmail.com * @email mends@prestashopbr.com * @version 0.3 **/class blockrss2 extends Module{	function __construct()	{		$this->name = 'blockrss2';		$this->tab = 'Blocks';		$this->version = 0.3;		parent::__construct(); // The parent construct is required for translations		$this->page = basename(__FILE__, '.php');		$this->displayName = $this->l('Block RSS2.0');		$this->description = $this->l('Adds a block to display Icons Web 2.0');	}	function install()	{		if (!parent::install())			return false;		if (!$this->registerHook('rightColumn') OR !$this->registerHook('leftColumn'))			return false;		return true;	}	/**	* Returns module content	*	* @param array $params Parameters	* @return string Content	*/	function hookRightColumn($params)	{		global $smarty;				if (!isset($_GET['id_category']) OR !Validate::isUnsignedId($_GET['id_category']))			$id_category = 0;				else		{			$category = new Category(intval(Tools::getValue('id_category')), intval($cookie->id_lang));			if (!Validate::isLoadedObject($category))				$id_category = 0;							else			$id_category = $category->id_category;		}							$smarty->assign		( array			(			'id_category' => $id_category,			'SHOPNAME' => Configuration::get('SHOP_NAME') 			)		);		return $this->display(__FILE__, 'blockrss2.tpl');	}	function hookLeftColumn($params)	{		return $this->hookRightColumn($params);	}}?>

I really dont understand a thing about them hooks.With this module there allsow came additions files like a TPL and a icon map.Maybe any 1 can see any logic here? A long shoot but worth a try

Link to comment
Share on other sites

First, you aren't going to be very successful without knowing a decent amount of PHP first, so don't feel bad if you don't understand the module system yet. They are using some fairly advanced techniques for this, so you can be expected to be confused until you're decently familiar with PHP.For any module you'll make, you'll need to create a class which extends their built-in Module class, they do that here:class blockrss2 extends ModuleThat defines a class called blockrss2, which is an extension of the built-in Module class. I'm assuming that the shopping cart defines a class called Module, which includes all of the basic things which any module needs. You can see evidence of that here:$this->displayName = $this->l('Block RSS2.0');$this->registerHook('rightColumn')Those lines are calling the "l" and "registerHook" methods of the class, but you can that those aren't defined in their module. Those are defined in the base Module class which their class extends, so you'll definitely also want to find the code for the Module class and see what's available there. I'm guessing that a lot of the properties they set in the constructor, like name, tab, version, etc, are defined in the base class.Hooks are basically events. If you're familiar with Javascript, it has events defined like onclick, onload, etc. Hooks are similar, there is probably a system in place where your module can hook into an existing part of the application, and when that gets executed it will look for things attached to hook and execute those as well. Since that module has hooks for the left and right columns, that looks like when those columns get drawn the application will find anything else that's hooked into those and allow those to add content to the columns. The application probably has many hooks available for modules to attach themselves to whatever they need to. The reason hooks are efficient are because you can add a new module with hooks without needing to change the base code of the application. With CubeCart, for example, the installation instructions for most modules give a listing of all of the PHP files and line numbers that you need to go manually edit in order to install the module, having a set of hooks instead makes it so that your module can work without you needing to modify the base code. That way, you can upgrade the application and all of the modules still work.

Link to comment
Share on other sites

Thanks alot for taking the time to explain this to me.This is the best information i have been given in the 6 weeks searching for a answer!I now know this is not possible to do for me at this stage.I guess ill try to make a temp solution in photoshop.Have to go back to w3shools and read up on the last part on javascript then 24/7 on the PHP,SQL :) (another month with coffee and red bull).

Link to comment
Share on other sites

You are right on the module hooks,so far i have found,left colum,right colum,and homeWith the hooks you place you content on the places above.I have found a way to place my things in these places :)When i place the content on on of the places above,it comes on a random place at the section placed.You can get it at the position you want with going in to the back-office and position your module.This is only working for the front page,so i indeed need to find the file with the registerhook to the product section of the page.What i think is maybe possible is,modify a module that makes a module in every block on the front page.I have this module,and in the block created you can add your own content like SWF.HTML,LINKS,and pictures..To add your things you just have to go to the back-office and upload you content to the module you want to use.So my question is: If i get the name of the registerhook of the product page and the colum name,cant i then just redirect this module to place the modules in the product page(picture colum)??This module allready does what i want,it just places the content in the wrong sections.Finaly getting somewhere i found the hook list :)Here are the Hook Table's:ps_hook1. payment2. newOrder3. paymentConfirm4. paymentReturn5. updateQuantity (Quantity is updated only when the customer effectively places his order.)6. rightColumn (Add blocks to rightColumn)7. leftColumn (Add blocks to leftColumn)8. home (Add blocks to Homepage content mainpage)9. header (Add blocks to header)10. cart (Cart creation and update)11. authentication12. addproduct13. updateproduct14. top (A hook which allow you to add modules to the top of each pages.)15. extraRight (Extra actions on the product page (right column)16. deleteproduct 17. productfooter (Add new blocks under the product description on the page)18. invoice (Add blocks to invoice (order))19. updateOrderStatus (Order's status update event - Launch modules when the order's status of an order changes.)20. adminOrder (Launch modules when the tab AdminOrder is displayed in the back Office.)21. footer (Add blocks to footer)22. PDFInvoice (Allows the display of extra information on the PDF invoice)23. adminCustomers (Launch modules when the tab AdminCustomers is displayed on back-office.)24. orderConfirmation (Called on order confirmation page)25. createAccount (Called when a new customer creates an account successfully)26. customerAccount (Will display in the Customer account page in the front office)27. orderSlip (Called when a quantity of one product is changed in an order or order slip created)28. productTab 29. productTabContent 30. shoppingCart (Display some specific information on the bottom of the shopping cart page)If im not wrong i need to direct the module to productTabContent?

Edited by Sensi420
Link to comment
Share on other sites

Yeah, it's hard to say which hooks do what, but you could always hook up a really obnoxious neon image or something and just look for where it shows up for the various hooks.Also, wouldn't it be great if the communities documented stuff like this? I've always wondered how that happens, if I'm in charge of a large open source system and I'm trying to get developers involved you better believe I'm going to spend some money to put together some decent developer documentation. It doesn't really make much sense not to have it.

Link to comment
Share on other sites

Yeah, it's hard to say which hooks do what, but you could always hook up a really obnoxious neon image or something and just look for where it shows up for the various hooks.Also, wouldn't it be great if the communities documented stuff like this? I've always wondered how that happens, if I'm in charge of a large open source system and I'm trying to get developers involved you better believe I'm going to spend some money to put together some decent developer documentation. It doesn't really make much sense not to have it.
I was thinking about the same thing really,upload a picture in the product block and rename it to something easy to spot.I have learned alot in the last 2 days about prestashop and i finaly found the missing pices.Tody i asked the question about why they did not update the wiki on the forum about development.Allsow said they should open up for developers,and not shut them out.The ps is a pice of art and it should be on top of the e-cart list,but if theydont change then they will dig there own grave!.A developer will only help ps grow stronger,but no reply so far so i guess they dont care.So no need to try to turn to the ps team for any help.I would have left ps a long time ago,but i see a lot of potentials in this software and i want to master it someday :)
Link to comment
Share on other sites

Allsow said they should open up for developers,and not shut them out.
That's the problem with the whole ecosystem they have set up. They develop an open-source product with no documentation, and what that leads to is a community of developers who have all taken the time to figure out the software themselves, then they start writing modules to sell. So you've got a bunch of developers who know how to work with it, and they're making money selling custom modules. Now it's in their interest to shut out new developers, because more developers mean more competition and less money for the existing developers. So these people actually have a financial interest not only in not helping new developers, but in actively shutting them out. When you produce a commercial piece of software which is open source and lacks developer documentation, that's the situation you end up with, a situation where a small group of developers is trying to make money and keep new developers from joining. I saw the exact same ecosystem around CubeCart for the exact same reasons. It was several years ago when I got fed up with the CubeCart "community", and looking at it today shows that they still have no developer documentation. It's actually in their interest to keep that information to themselves. It would be up to the owners of the software to produce that documentation, the people selling modules aren't going to do it. If the owners ponied up a little cash to get some decent documentation out there, they would find their community expanding and they would probably start seeing a lot more customers because of the larger community, but for reasons that are lost to me they don't want to make that investment.
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
 Share

×
×
  • Create New...