Post to a RAW view

  • Posts: 69
  • Thank you received: 11
11 years 10 months ago #83247

Hi guys,

Ww are working on a messaging view for Vendores, we added a new button to the Vendor's Cpanel that reads "Messages", when clicked, it takes us to a new view called messagemarket, layout = inbox.

This works fine.

I need to be able to post to the same view but in RAW format ( AJAX ), I added a new controller and the RAW view, in the normal MVC model, I would create this and it will automatically direct me to the correct view file ( view.raw.php) and I would receive a response in the correct format ( no template) TEXT or JSON.

Instead of receiving this response, I get a 403 error: Access Denied.

Q: What is the correct way of post with AJAX and receive RAW response in Hikamarket?


Eduardo Chongkan - Likan Development
http://likandevelopment.com

Please Log in or Create an account to join the conversation.

  • Posts: 26156
  • Thank you received: 4028
  • MODERATOR
11 years 10 months ago #83256

Hi,

HikaMarket use the "authorization" function. Each task has to be listed in the controller.

protected $rights = array(
	'display' => array('cpanel', 'show', 'register', 'form'),
	'add' => array(),
	'edit' => array('save'),
	'modify' => array(),
	'delete' => array()
);
Some task categories ask for a token (modify / delete). The display category is the default one.
If a task is not listed in this array, the controller would refused it.

I have implemented for the next release of HikaMarket a way to override every classes (or some helpers). I think I will provide such solution for overriding views and controllers.
The idea is to create a new file in the same directory. If you want to override the vendor controller, you would create a file named "vendor.override.php".
This file would be include instead of the classical controller.

The idea is to extend to controller without rewrite it.
<?php
include dirname(__FILE__).DS.'vendor.php';
class vendorMarketOverrideController extends vendorMarketController {
	public function __construct($config = array(), $skip = false) {
		$this->rights['display'][] = 'mytask';
		parent::__construct($config, $skip);
	}
	public function mytask() {
		JRequest::setVar('layout', 'mytask');
		return parent::display();
	}
}

Like that, you can add and override all you want without loosing any compatibility.
If a controller changes in HikaMarket, some new task are added, you could still update and use the new features ; without loosing yours.
(And I think I will add a function in order to provide a good way to merge rights)

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: likandev

Please Log in or Create an account to join the conversation.

  • Posts: 69
  • Thank you received: 11
11 years 10 months ago #83291

Hi Thanks,

I'll keep it in mind for next time. Yesterday I decided to just use a component I made for posting to it via ajax from anywhere ( modules in example )

That way I can keep my code separated. I did keep the additional views I made.


Eduardo Chongkan - Likan Development
http://likandevelopment.com

Please Log in or Create an account to join the conversation.

Moderators: Obsidev
Time to create page: 0.063 seconds
Powered by Kunena Forum