AbanteCart Community

AbanteCart Development => Customization help => Topic started by: Green on December 21, 2014, 01:14:42 AM

Title: New extension
Post by: Green on December 21, 2014, 01:14:42 AM
This is my new sample extension.I replicated the code of product-purchased for testing. When i run this code, "page not found " is what i get. I have went through the documentations of abantecart, but i don know how to resolve this problem.Please give any suggestions to resolve this.
Title: Re: New extension
Post by: yonghan on December 21, 2014, 04:07:42 AM
Hello,remove the .php for the $controllers from main.php file so it become like this:

Code: [Select]
$controllers = array(
    'storefront' => array(),
    'admin' => array(
        'pages/trial/trial',
        'responses/trial/trial'));

The developer tools add .php to $controllers by default,so we need to remove it manually.

Hope it helps.
Title: Re: New extension
Post by: Green on December 21, 2014, 05:07:04 AM
I dont know how to thank you... Thousands of thanks to you.... Its working.. :D :D :D :D :D :) :) :) :) .... But i dont get value in listing_grid?.. Could you please help me..
Title: Re: New extension
Post by: yonghan on December 21, 2014, 08:14:08 AM
I suggest you to read abantecart code first before creating extension that utilize listing_grid,so you know the flow or else you will be stuck.I previously spend time to read the code before creating extension.Here's a hint for you.Learn from the product listing grid:

admin\controller\pages\catalog\product.php from line 61-84
admin\controller\responses\listing_grid\product.php

Hope it helps




Title: Re: New extension
Post by: Green on December 21, 2014, 09:30:45 AM
Yeah..I found where the problem is.Very thanks for your time to reply.
Quote
         if (is_file($dir_app .  $path_build . '.php')) {
             echo "<script> console.log('inside if')</script>";
            //Set pure controller route
            $this->controller = $path_build;
            //Set full file path to controller
            $this->file = $dir_app . $path_build . '.php';
            echo "<script> console.log('file :   $dir_app/$path_build ')</script>";
            //Build Controller class name
            $this->class = 'Controller' . preg_replace('/[^a-zA-Z0-9]/', '', $path_build);
            array_shift($path_nodes);
            $pathfound = true;
            break;
         }

here my pages/trial/trial.php is not taken as file,its taken as folder.I don know why.
Title: Re: New extension
Post by: Green on December 22, 2014, 03:54:33 AM
My code is not coming into controller/responses/. where to find the problem?
Title: Re: New extension
Post by: abantecart on December 22, 2014, 09:45:08 AM
My code is not coming into controller/responses/. where to find the problem?
What do you mean?
Response controller should be called directly from URL or dispatcher instance.
Make sure the name of the controller and path is correct, as well as class name inside of controller itself.