PHP Classes

File: engine/modules/contrib/ecommerce/ecommerce.hook.inc

Recommend this page to a friend!
  Classes of Aldo Tripiciano   Quanta CMS   engine/modules/contrib/ecommerce/ecommerce.hook.inc   Download  
File: engine/modules/contrib/ecommerce/ecommerce.hook.inc
Role: Example script
Content type: text/plain
Description: Example script
Class: Quanta CMS
Manage content that works without a database
Author: By
Last change:
Date: 5 years ago
Size: 1,264 bytes
 

Contents

Class file image Download
<?php
/**
 * Implements hook_shadow_node_edit().
 *
 * @param Environment $env
 * The Environment.
 *
 * @param array $vars
 * Miscellaneous variables.
 */
function ecommerce_shadow_product_form($env, $vars) {
 
$user = UserFactory::current($vars['env']);
 
$node = NodeFactory::current($env);
  if (!
$user->checkAccess($node, NODE_ACTION_EDIT)) {
    return
FALSE;
  }
 
$vars['shadow']->addTab('product information', file_get_contents('core/ecommerce/tpl/ecommerce_form.inc'), 2);
}


/**
 * Implements hook_load_includes().
 *
 * @param Environment $env
 * The Environment.
 *
 * @param $vars
 * An array of variables.
 */
function ecommerce_load_includes($env, $vars) {
 
$module_path = $env->getModulePath('ecommerce');
 
$env->addInclude($module_path . '/js/ecommerce.js');
 
$env->addInclude($module_path . '/css/ecommerce.css');
}

/**
 * Implements hook_node_save().
 *
 * @param Environment $env
 * The Environment.
 *
 * @param array $vars
 * Mixed variables.
 */
function ecommerce_node_presave($env, $vars) {
  if (isset(
$vars['data']['price'])) {
   
$vars['node']->json->price = $vars['data']['price'];
   
$vars['node']->json->availability = $vars['data']['availability'];
   
$vars['node']->json->stock = $vars['data']['stock'];
  }
}