Jump to content
Latest News: (loading..)

Search the Community

Showing results for tags 'tuto'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News and Announcements
    • News and Announcements
    • Partner Announcements
    • Ambassadors
  • Commercial Support
    • Developer Feedback
  • osCommerce Online Merchant v2.x
    • General Support
    • Installation and Configuration
    • Upgrading from Earlier Versions (v2.x to v2.x)
    • Add-Ons
    • Tips and Tricks
    • Security
  • Development
    • osCommerce Online Merchant v2.4
    • osCommerce Online Merchant Community Bootstrap Edition
    • osCommerce Online Merchant v3.x
    • Development Proposals
  • General
    • OSCOMMERCE.TV
    • Next Steps / Optimizations / Marketing
    • Live Shop Reviews
    • E-Commerce Laws
    • General Discussions
    • PHP / SQL / Web Design
  • oscBooks and oscTemplates's Announcements
  • PayPal's Announcements
  • Sage Pay's Announcements
  • Solomono - new level osCommerce templates's Announcements
  • German Community's OSCOM v2.x
  • German Community's Allgemein
  • German Community's OSCOM v3.x

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Real Name


Location


Interests


Website


Skype

Found 2 results

  1. Hello, I am continuing my investigations under osc 2.4 and my learning This tuto will help you to create a new header Tags approach inside OSC using the new concept in 2.4 App Currently, header tags is under includes/modules/header_tags. The goal is to include Header Tags inside the Apps. That's the goals to make. How to do that ? Currently, Osc 2.4 doesn't include this element. I don't know if @Harald Ponce de Leon want to include that inside OSC. The main advantage of this approach is to develop an APPS with all inside a directory and not to have all information everywhere inside the sites. It's just a little modification inside template.php. That's all to have something cool :) @Harald Ponce de Leon is to you to decide if you want to include this element inside App. How to do that ! ================================= Step 1 : Preparation of the elements including abstract and Interface 1-a includes/OM/Modules create a files called HeaderTags.php <?php /* * HeaderTags.php * @copyright Copyright 2008 - gyakutsuki * @copyright Portions Copyright osCommerce * @license GNU Public License V2.0 */ namespace OSC\OM\Modules; use OSC\OM\Apps; class HeaderTags extends \OSC\OM\ModulesAbstract { public function getInfo($app, $key, $data) { $result = []; $class = $this->ns . $app . '\\' . $data; if (is_subclass_of($class, 'OSC\OM\Modules\\' . $this->code . 'Interface')) { $result[$app . '\\' . $key] = $class; } return $result; } public function getClass($module) { list($vendor, $app, $code) = explode('\\', $module, 3); $info = Apps::getInfo($vendor . '\\' . $app); if (isset($info['modules'][$this->code][$code])) { return $this->ns . $vendor . '\\' . $app . '\\' . $info['modules'][$this->code][$code]; } } } 2-a includes/OM/Modules create a files called HeaderTagsAbstract.php <?php /* * HeaderTagsAbstract.php * @copyright Copyright 2008 - Gyakutsuki * @copyright Portions Copyright osCommerce * @license GNU Public License V2.0 */ namespace OSC\OM\Modules; use OSC\OM\Registry; abstract class HeaderTagsAbstract implements \OSC\OM\Modules\HeaderTagsInterface { public $code; public $title; public $description; public $sort_order; public $enabled = false; protected $db; abstract protected function init(); abstract public function getOutput(); abstract public function install(); abstract public function keys(); final public function __construct() { $this->code = (new \ReflectionClass($this))->getShortName(); $this->db = Registry::get('Db'); $this->init(); } public function isEnabled() { return $this->enabled; } public function check() { return isset($this->sort_order); } public function remove() { return $this->db->exec('delete from :table_configuration where configuration_key in ("' . implode('", "', $this->keys()) . '")'); } } 3-a includes/OM/Modules create a files called HeaderTagsAbstract.php <?php /* * HeaderTagsInterface.php * @copyright Copyright 2008 - Gyakutsuki * @copyright Portions Copyright osCommerce * @license GNU Public License V2.0 */ namespace OSC\OM\Modules; interface HeaderTagsInterface { public function getOutput(); public function install(); public function keys(); public function isEnabled(); public function check(); public function remove(); } ===================================== Step 2 Call the new class element inside template Edit includes/classes/osc_templates 1-a Just after use OSC\OM\Registry; add use OSC\OM\Apps; 2-a just before function addBlock($block, $group) { $this->_blocks[$group][] = $block; } Add public function getAppsHeaderTags() { if ( defined('MODULE_HEADER_TAGS_INSTALLED') && !is_null(MODULE_HEADER_TAGS_INSTALLED) ) { $header_tags_array = explode(';', MODULE_HEADER_TAGS_INSTALLED); foreach ($header_tags_array as $header) { if (strpos($header, '\\') !== false) { $class = Apps::getModuleClass($header, 'HeaderTags'); $ad = new $class(); if ( $ad->isEnabled() ) { echo $ad->getOutput(); } } } } } ===================================== Step 3 : Called inside your app the header tag I am supposing you have developped an app, there the main elements to include inside 3-a edit your oscommerce.json just below "modules": { add "HeaderTags": { "RSS": "Module\\HeaderTags\\RSS" }, 3-b Create a directory called - Module -- Headertags 3-c Create a files called RSS An full example about the rss header tags <?php /** * RSS.php * @copyright Copyright 2008 - Gyakutsuki * @copyright Portions Copyright osCommerce * @license GNU Public License V2.0 */ namespace OSC\Apps\Communication\PageManager\Module\HeaderTags; use OSC\OM\Registry; use OSC\OM\HTTP; use OSC\Apps\Communication\PageManager\PageManager as PageManagerApp; class RSS extends \OSC\OM\Modules\HeaderTagsAbstract { protected $lang; public $group; protected function init() { if (!Registry::exists('PageManager')) { Registry::set('PageManager', new PageManagerApp()); } $this->app = Registry::get('PageManager'); $this->lang = Registry::get('Language'); $this->group = 'header_tags'; // could be header_tags or footer_scripts $this->app->loadDefinitions('Module/Admin/header_tags/rss'); $this->title = $this->app->getDef('module_header_tags_rss_title'); $this->description = $this->app->getDef('module_header_tags_rss_description'); if ( defined('MODULE_HEADER_TAGS_RSS_STATUS') ) { $this->sort_order = (int)MODULE_HEADER_TAGS_RSS_SORT_ORDER; $this->enabled = (MODULE_HEADER_TAGS_RSS_STATUS == 'True'); } } public function isEnabled() { return $this->enabled; } public function getOutput() { $xml = $OSCOM_Template->addBlock('<link rel="alternate" type="application/rss+xml" title="' . STORE_NAME . '" href="index.php?Info&RSS'.'">', $this->group); $output = <<<EOD {$xml} EOD; return $output; } public function Install() { $this->app->db->save('configuration', [ 'configuration_title' => 'Do you want install this module ?', 'configuration_key' => 'MODULE_HEADER_TAGS_RSS_STATUS', 'configuration_value' => 'True', 'configuration_description' => 'Do you want install this module ?', 'configuration_group_id' => '6', 'sort_order' => '1', 'set_function' => 'osc_cfg_set_boolean_value(array(\'True\', \'False\'))', 'date_added' => 'now()' ] ); $this->app->db->save('configuration', [ 'configuration_title' => 'Display sort order', 'configuration_key' => 'MODULE_HEADER_TAGS_RSS_SORT_ORDER', 'configuration_value' => '210', 'configuration_description' => 'Display sort order (The lower is displayd in first)', 'configuration_group_id' => '6', 'sort_order' => '215', 'set_function' => '', 'date_added' => 'now()' ] ); } public function keys() { return ['MODULE_HEADER_TAGS_RSS_STATUS', 'MODULE_HEADER_TAGS_RSS_SORT_ORDER' ]; } } ===================================== Step 4 4-a Edit OSC/Sites/templates/Sail Just above (important) this code <?php echo $oscTemplate->getBlocks('header_tags'); ?> add <?php echo $oscTemplate->getAppsHeaderTags(); ?> I hope do not forgotten anything That'All !! Others tutos about OSC 2.4
  2. @Frankl and the communty has created a great example about APP. But this example does'nt have elements to create a page in front office. This tuto resolve this point. You will the base to develop you own page We want to create a new enhanced contact us page for example This example don't give you all the code about the admin, classes .... Just the necessary to create a catalog page Below you will find all the code to start correctly ? After you must complete the elements by your own code Note : In App you can : Create page In admin Create page in Shop Add content in Shop (header / content / footer) Add Hook inside a page (like action, save, delete, insert, update) Add module like order total, payment, shipping ... You can not : Create a boxe (I tried with no success) : use the default osc approach Create a header_tag : use the default osc approach Go back to our code ! Step one oscommerce.json add Shop Element Info&Contact will be your link to access via the catalog Sites\\Shop\\Pages\\Manager is the location about the files and process "routes": { "Admin": "Sites\\Admin\\Pages\\Home", "Shop": { "Info&Contact": "Sites\\Shop\\Pages\\Manager" } } Step 2 Create your directories Apps -Communication --Manager ---languages ----- english ------- Sites ---------Shop ----------Manager ---Sites -----Shop ------Pages -------Manager --------Actions ----------Contact --------templates Step 3 Now in directories languages/english/...../Manager create contact.txt add heading_title = Contact US Step 4 Now in directories Sites/Shop/Pages/Manager create a file Manager.php Add namespace OSC\Apps\Communication\Manager\Sites\Shop\Pages\Manager; use OSC\OM\Registry; use OSC\Apps\Communication\Manager\Manager as ManagerAPP; class Manager extends \OSC\OM\PagesAbstract { public $app; protected function init() { $OSCOM_Manager = new ManagerAPP(); Registry::set('ManagerAPP', $OSCOM_Manager); $this->app = Registry::get('Manager'); $this->app->loadDefinitions('Sites/Shop/main'); // not necessary } } Step 5 Now in directories Sites/Shop/Pages/Manager/Actions create a file Contact.php Add namespace OSC\Apps\Communication\Manager\Sites\Shop\Pages\Manager\Actions; use OSC\OM\OSCOM; use OSC\OM\Registry; use OSC\OM\HTML; class Contact extends \OSC\OM\PagesActionsAbstract { public function execute() { global $breadcrumb, $OSCOM_Manager; $OSCOM_Manager = Registry::get('Manager'); // display or not the page (admin action) if (!defined('OSC_APP_MANAGER_STATUS') || !in_array(OSC_APP_MANAGER_STATUS, [ '1', '0' ])) { return false; } $this->page->setFile('contact.php'); $this->page->data['action'] = 'Contact'; //language $OSCOM_Manager->loadDefinitions('Sites/Shop/Manager/contact'); $breadcrumb->add(OSCOM_Manager->getDef('navbar_title'), OSCOM_Manager->link('index.php', 'Info&Contact')); } } Step 6 Now in directories Sites/Shop/Pages/Manager/Actions/Contact create a file Process.php Add namespace OSC\Apps\Communication\Manager\Sites\Shop\Pages\Manager\Actions\Contact; use OSC\OM\Registry; class Process extends \OSC\OM\PagesActionsAbstract { public function execute() { $OSCOM_Manager = Registry::get('Manager'); ------- your code to manage the process about the form ----- // Redirect on other page $OSCOM_Manager->redirect('index.php', 'Info&Contact&Success'); } } Step 7 Now in directories Sites/Shop/Pages/Manager/templates create a file contact.php Add <?php use OSC\OM\OSCOM; use OSC\OM\Registry; use OSC\OM\HTML; ?> <div class="page-header"> <h1><?php echo $OSCOM_PageManager->getDef('heading_title'); ?></h1> </div> <?php echo HTML::form('contact', OSCOM::link('index.php', 'Info&Contact&Process'), 'post', 'enctype="multipart/form-data"', ['tokenize' => true]); ?> ---- you can continue with your code ---- Step 8 Now to access at your page : http://www.mysite/catalog/index.php?Info&Contact
×