Coder Social home page Coder Social logo

yousticeresolutionsystem's Introduction

Youstice Prestashop module

Description

Resolve customer complaints in a few clicks.

Supports Prestashop versions 1.5 and 1.6

yousticeresolutionsystem's People

Contributors

devyoustice avatar quetzacoalt91 avatar mmoustai avatar

Stargazers

Felipe Monteiro avatar

Watchers

Luc Vandesype avatar Tomáš Gajdošík avatar James Cloos avatar François-Marie de Jouvencel avatar Rémi Gaillard avatar  avatar Mathieu Ferment avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar Jonathan Lelievre avatar  avatar Jarvis avatar  avatar  avatar Emmanuelf avatar  avatar  avatar

yousticeresolutionsystem's Issues

JS error when themeconfigurator is enabled

When the module theme configurator is enabled and used on PrestaShop 1.6, the url is changed because parameters are added.

in consequence, this piece of code in /public/js/yrs_order_history.js (l.98)

    function showOrdersButtons() {

    if ($('#order-list').length) {

        var order_ids = new Array();
        $('#order-list tbody tr').each(function() {
        var order_href = $(this).find('.history_detail a:last').attr('href');
        var order_id = order_href.split('id_order=')[1];
        order_ids.push(order_id);
        $this = $(this).find('td.history_link');
        $('#report-order-' + order_id).remove();
        $this.append('<div id="report-order-' + order_id + '" style="min-width:230px;min-height: 36px;"></div>');
        showAjaxSpinner('#report-order-' + order_id);
        });

brings me the following error
capture du 2014-09-12 14 29 28

When I check the content of the variable order_id, I get this value:

5&live_configurator_token=13aa9d50afdea4b4771192ccd2027122&id_shop=1&id_employee=1&theme=&theme_font=

and the expected value should be

5

Fancybox

The fancybox plugin is already part of PrestaShop. To avoid any conflicts you cannot include your own version.

Local.php & database

You cannot create your own class, you have to use the classes & methods given by the core, i.e: Db::getInstance()->execute(...);

Validation

Some files does not respect the PrestaShop's coding standards at all.
As they are not part of a SDK they should use the PrestaShop's coding standards.

Don't forget to use the validator: https://validator.prestashop.com/

cURL Library

The module should display a warning message to inform the merchant if he has not installed the cURL library.

Security review

Here is the report from the security review:

# Display products of orders not belonging to the customer

/controllers/front/yrs.php:236 function getOrderDetail()

By bruteforcing order_id, we can see the products of order not belonging to us.

Check $shop_order belong to $this->context->customer->id

Do not use $this->customer_id in this case (as it is done in getOrdersButtons), because it can be defined by only knowing the email of the customer (in authenticateUser() function). If you secure this using $this->customer_id, it would be a bigger vulnerability because we could know what a customer did buy (by enumerating order_id 1,2,3,... with a specific email). Now we can just see products of all the orders, without really knowing to whom those commands belong.

In others cases (getReportClaimsPagePost(),...) it's ok because you have to know both the email of the customer and the reference of the command which is not a logical number suite like 1,2,3,4,... but a complex alphanumeric string the attacker can't guess.

getOrdersButtons()/getProductsButtons(): same problem that getOrderDetail() but not critical, no sensitive information are displayed. nothing to fix.

Translations

PrestaShop already includes a translation system, you cannot use your own.
Using your own translation system merchant will not be able to changes sentences.

Report 2.0

Hi,

After a new review of the module, you can find the following tasks to do:

  • You began to use the PrestaShop translations, which is good, but many sentences still need to be translated.
    We want you to use the existing system to keep PrestaShop and his modules easy to understand:

-> It will allow the community to know how their module is supposed to work and which functionalities are already offered by PrestaShop. If we allow every contributor or partner reinventing the wheel, we won't be able to give a model to use for the next modules.
-> We don't overload the shops with multiple systems which do exactly the same thing.
-> With the PrestaShop system, you can easily update the translations even if you can't access the PHP files. They are automatically generated by PrestaShop every time the changes are saved.
-> In your case, taking the step from your system to ours won't ask you a lot of time. For example in yousticeresolutionsystem.php (l.74):

$this->y_api->t('File a complaint') 

would become

$this->l('File a complaint') 
  • The HTML code should be in tpl (smarty) files, which are located in /templates/front|admin|hook.
    You can find more information here: http://doc.prestashop.com/display/PS15/Creating+a+PrestaShop+module#CreatingaPrestaShopmodule-Organizingyourmodule
  • FancyBox and jQuery already exist on PrestaShop and css, img and js can be safely removed from your module.
  • Your function checkFooterLink() verify if the module's logo exists in the shop's footer. If not, you ask the merchant for modifying the theme. But these modifications are susceptible to be removed on each PS upgrade or when an other theme in installed.
    If you want to show your logo on the footer, you have different hooks which will answer your needs:
    -> hookDisplayFooter for the front office
    -> displayBackOfficeFooter for the back office

If you use it you will be able to add the template you want, without modifying the theme or the core.

  • As we already said on an issue, your sdk should be in a folder renamed sdk.
  • index.php files are only used to protect the folders against exploring. You need a ModuleFrontController if you want to add functionalities with your module on the front-office.

Sessions

The use of $_SESSION is forbidden. You can use cookies only.

Exception format incompatible

In /controllers/front/yrscontroller.php, the way you catch exceptions is incompatible with PHP 5.1 / 5.2.

catch(\Exception $e) {

should be

catch(Exception $e) {

Namespaces

Since PrestaShop should be fully compliant with PHP >= 5.2 the use of namespaces is forbidden.

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.