Git Product home page Git Product logo

mymodcomments's People

Contributors

fabienserny avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mymodcomments's Issues

Problem with Override

Hei Fabien, I'm studying your module using your book. I have a problem in Search.php override. My $product.mymodcomments variable doesn't exist after uninstalled and re-installed the module. It's like the Search override doesn't work (I checked if in class_index the path is changed, and it is changed in override/classes/Search.php).

Chapter 5 - comments page does not include overall theme's set up

Hi
I am using Prestashop 1.7.2.4 and I have your Chapter 5 comments working after a few hiccups.

Those hiccups were related to the method in initContent() throwing an error ( already reported in a separate issue) and also the setTemplate method being unable to find the template.

For the first one I adjusted code as follows:

        `		
            if ($id_product > 0 && isset($actions_list[$module_action]))
	{
		$method = $actions_list[$module_action];
		$this->$method();
	}
          `

For the setTemplate, it looks like follows:

$this->setTemplate('module:mymodcomments/views/templates/front/list.tpl');

Now, the issue I actually have is that while the comments page shows, it is a completely unstyled page, outside of the theme's setup.

As you sure understand, one wants to have the same look and feel as per the rest of the website.
I would appreciate if you could show me the way.

Thanks

Bernard

PS:
By the way, as you are certainly aware, the addCSS and addJS methods included in the setMedia method do not work in PS 1.7. I believe they should be added in hooks now.

Try/Catch error

Hi Fabien (Always me ehehe : ] ),
in your book you suggest to use the try/catch error around the $MyModComments->add() method and you say to check here to see the changes. Where I can find the changes in order to have the example?! I tried to search in controllers/front/displayProductTabContent but there I see you use the "old" method.

Chapter 6

Hi,
I'm trying to display the single comment in the backend section and at page 105 you write:

We will now display the details of the comment. In your admin controller, when you
are on a view or edit page, the selected ObjectModel class is automatically loaded
in $this->object. So in your renderView method, you just have to assign the
ObjectModel class to Smarty:
$tpl->assign('mymodcomment', $this->object);

I have added that code:

public function renderView()
{
    $tpl = $this->context->smarty->createTemplate( dirname( __FILE__ ) . '/../../views/templates/admin/view.tpl' );
    $tpl->assign( 'mymodcomment', $this->object );

    return $tpl->fetch();
}

but the comment info are not displayed in the view.
If I try to die and dump $this->objectit results empty.

Am I missing something?
Thanks for your time!

Chapter 5: Front controllers, Object Models and Overrides (comments.php)

Hello,

I'm using your tutorial to make my first module. But I get the error in Chapter 5.


if ($id_product > 0 && isset($actions_list[$module_action]))    {
            $this->$actions_list[$module_action]()

Error message:

Notice: Array to string conversion in C:\xampp\htdocs\presta\modules\mymodcomments\controllers\front\comments.php on line 19

Notice: Undefined property: MyModCommentsCommentsModuleFrontController::$Array in C:\xampp\htdocs\presta\modules\mymodcomments\controllers\front\comments.php on line 19

Fatal error: Uncaught Error: Function name must be a string in C:\xampp\htdocs\presta\modules\mymodcomments\controllers\front\comments.php:19 Stack trace: #0 C:\xampp\htdocs\presta\classes\controller\Controller.php(189): MyModCommentsCommentsModuleFrontController->initContent() #1 C:\xampp\htdocs\presta\classes\Dispatcher.php(367): ControllerCore->run() #2 C:\xampp\htdocs\presta\index.php(28): DispatcherCore->dispatch() #3 {main} thrown in C:\xampp\htdocs\presta\modules\mymodcomments\controllers\front\comments.php on line 19

Override Product

Hi Fabien.

In your override class Product, you use $this->id, but when I try this, the value is null. I've created this small function, similar to yours:

<?php

class Product extends ProductCore
{
	public function getCommentsCount()
	{
                 $sql = "SELECT count(id_product) FROM "._DB_PREFIX_."stpc_comments WHERE id_product = ".$this->id;
		$comments = Db::getInstance()->getValue($sql);
		return $comments;
	}
}

But $this->id is always null.

What's wrong?
Thanks.

override de mymodcomments

Bonjour Fabien, je bosse sur ton livre de création de module sous Prestashop et j'ai un soucis au niveau de la partie override du module mymodcomments.

  • je travaille sur prestashop 1.7
    -Apres avoir creer la classe Search, le probleme reside dans l 'appel de l'override depuis le template. j'ouvre le template /theme/classic/product.tpl( au lieu de theme-default-bootstrap/product-list.tpl) et {$product.mymodcomments.grade_avg} n est pas reconnu.
    Avez la solution?
    merci

Problem with book

Hi,
I'm following your book PrestaShop Module Development and developing the mymodcomments module but there are some problem with the code in the book.

At page 26 you define an html form and at page 29 you try to get the product id with:

$id_product = Tools::getValue('id_product');

but in the form there is no field that match this, I have hardcoded it in order to continue with the book

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.