Add new entities in OpenCart - php

I was wondering if I can add new entities (classes/tables) in OpenCart to store information that is not included in the default functionality. To be more precise, I would like to add subscription (3/6/12 months) related information, as described here: OpenCart subscription model (x months)
If yes, can I just add admin pages for the new class? Would something like: How to create a custom admin page in opencart? work?

You would need to create a
Template file (.tpl)
Controller file (.php)
Model file (.php)
Language file (.php)
All files are named the same with different extensions and located in their respective folders
You will also need to add more columns in the database named with the additional settings you ant to store.
In addition to your page specific setup you will also need to add a link to your page in the header file, in the menu.
You will use the model file to insert, update and delete data within the database. The controller controls what functions within the model are used.
Once created, In admin/ user group permissions you need to give access o the new pages
Take a look at the existing files to see how it works. Make a copy of one of the more simpler 4 files, rename, then start to modify them.
If you only want to add more settings to a existing page then you can add them to the existing 4 files and add columns in the database.
Hope that helps get you started, Good luck!

Related

how to make news and articles using the same silverstripe news module?

I need to incorporate News and Announcements in my silverstripe website, both news and announcements have the exact same structure and they both use https://github.com/nyeholt/silverstripe-news. in the html template I have two sections one for the news and another for the announcements.
what is the proper way to implement this:
should I just copy and past the /news module folder and use one for the news and the other for announcements.
or add another db field as flag to specify if this is a news article or an announcement article, but then in the cms the user would have to check this every time.
or is there anything else, I don't know
Duplicating the folder would not have the result you expect unless youd rename all the classes in side of the new one.
Basically the folder is just a place for the classes to be, not something that you access when you actually request an news article, you use SilverStripes routes for that.
Static assets would be something that are be loaded from a module folder.
The best way to add a new behaviour to an extension is to use a DataExtension.
See https://docs.silverstripe.org/en/3.4/developer_guides/extending/extensions/
Other way would be if the module uses sitetree for placing the "news holder". Then you have the option also to just create two holders with different names and then if you want to show a list of a paricular parent just filter with the parentId that relates to the correct holder.
Third option would be to just would to add a new class under mysite that extends the modules classes and override only SOME of the methods to suite your needs.

magento 1.8 multi language storeview with custom theme set up

I am new to Magento. I am working on Magento 1.8 and having problem while creating multi-store-views for different language's. I have done some configuration from backend, I gpt the multiple-store-view. Its converted from English to French but its not converting to Malaysia language. my steps are as follows
Note: I am using responsive custom theme.
Go to the site: http://www.magentocommerce.com/translations and download the proper language that you are looking for.
Extract and upload the files you downloaded to your Magento’s root directory. Keep in mind it will upload files to your app folder in Magento, but unless you try with a language that you already have there, it won’t overwrite anything as it’s a new language.
Once you finish uploading, go to your Magento’s Admin.
Go to: System>Manage Stores.
Click on “Create A Store View”.
Once there comes the really important thing: Put the name you want for the “Name” field, but in your “Code” field, make sure you enter your main theme followed by a “_” (underscore) and then the name of the language you want to use. Even if you used a new template that you did or purchase it would be under a main template type (default or base). Let’s say you have a new template you purchased called “MAG0873″ and its folder resides under “default”. Also, let’s say you installed Spanish language, then you would put “default_spanish” in this field.
Save it and now go to: System>Configuration.
There, select your new Store View name from the “Current Configuration Scope” item in the top left column.
Now, go to the option: General>Locale.
After that, uncheck the option “Use Website” and make sure you change “Locale” field to the language you downloaded (be specific according to the dropdown list!).
Save it after changing it and now clean your cache and refresh your FrontEnd.
Now, few important things:
If you didn’t deactivate the original Store View a new dropdown will appear in the FrontEnd to change the language and the new Store View’s Name will appear there. Once you select it, the entire template should switch its language.
It might happen it switches language but, it also shows old/default template, well, no worries, this means you need to set up your new Store View to use the proper template according to your design set up. The next steps are specific for the persons who install templates through the System>Design option as I do (which I think is the easier and faster way).
Go to System>Design
Add a new Design.
In the “Store” field, select the new Store View you recently created.
.Now select the “Custom Design” you previously installed in your system.
Save it.
Now, your store should be using the proper design in the proper Store View (language).
Ok, now it happens that the hoe page doesn’t show exactly as you had it on the original (English) language? Well, it might be happening that the Home page is set up for an specific Store View. To fix it, just go to CMS>Pages, now click on the “Home” record (assuming you are using default settings that come with Magento) and then in its options make sure you have “Store View” field set up to “All Store Views”. Save it now.
What's mistake i have done here.
Thanks in advance
If you'd like to have a well configured multi-language Magento setup you need to follow the steps below:
Setup a separate Store View for each language (System -> Manage
Stores -> Create store view);
Apply a Locale for each Store View (System -> Configuration ->
General -> Locale Options, select Desired Store View in "Current
Configuration Scope" drop-down in left-side navigation);
Make sure that you have translated all of your CMS pages to all of
your languages. You need to create a unique CMS page for each store
view;
If you'd like to use a separate theme for each language just do it in
System–>Configuration–>General under the Design tab;
In case you need to make a different set of categories in Navigation
menu for each store view, you may control it by "Include in Navigation
Menu" category attribute (Just choose a category for edit and go to
General Information tab). Change all text attributes in Catalog Products and Categories for
each store view
The more detailed guide find here:
http://sherodesigns.com/magento-tutorial/magento-tutorial-creating-multi-language-stores/

How to add a new view (and also a new Menu Item Type) to existing joomla 2.5 components?

Maybe I want to add a new view, and also a new Menu Item Type to content component.
What are the steps please?
UPDATE
Question (by #ValentinDespa) :
You want to extend com_content functionality or you want to override a
view or to build a new component that does something?
As I said, I want to extend com_content and add a new view to it. There are some views like Single Article, Category Blog, and Category List right now.
I want to add another menu items called Article Titles, so titles only will be displayed but with some parameters (like columns count).
It is a need that is not supplied by current features.
NOTE
Guys, it doesn't matter what my new view should be like, please tell me How to create a new view.
Yes You can create a new view.
Its simple just copy any of the view (category,blog) from your com_content.
The file structure should be like inside the folder.
Step 1
view.html.php
tmpl
your layout names(default.php)
xml file.
Also remember to change the class name of the view.html.php
Step 2
Add a controller file (just make a copy of existing one category or blog)
Controller name must be your new view folder name.
Also remember to change the class name of the controller
step 3
add a model file for your new view (same make copy of any existing)
remember to change the class name and file name should be view folder name.
Then you can access this view by giving correct url.
eg: www.example.com/index.php?option=com_content&view=yourviewname&layout=yourlayoutnames.
Here I mentioned view folder name must be controller and model file name we can achieve with other name also but it will create problem for you when you are not good in joomla.
Note:
For adding a view you don't need to install a component its not a good idea at all.
Also You can add multiple layouts in a view
inside your tmpl folder just create new files.Also don't miss the controller and model to put in com_contents/controller and com_contents/model folder
for More help take a look at this

Typo3: Is it possible to make a custom flexform for an extension?

I'm making an extension where the user is able to post posts. But I want the extension to be dynamic so that for example on one page the user can upload pictures where as on another page the user can not upload pictures but some text.
I want to be able to create a template for the plugins backend and one for the frontend that you can modify for each use of the plugin.
I know there is flexform but with that the user of the plugin has to modify the plugin...
Is is possible and if so, how can I do it?
You should be able to modify the TCA for the field pi_flexform before its rendered by using some of the existing hooks in the core methods, thus changing what XML file (containing flexform configuration) is loaded for your plugin. As this is page config, it can be different for each page but it can be inherited by subpages.
While class.t3lib_tceforms.php contains lots of hooks, I believe that for changing TCA on the fly you will have to use a different one: postUserLookUp in t3lib/class.t3lib_userauth.php.
Create a class that would contain method modifying TCA and register it in ext_localconf.php:
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['postUserLookUp'][] = 'EXT:YOUR_EXTENSION/class.YOUR_CLASS.php:YOUR_CLASS->YOUR_METHOD';
In your custom method override TCA for $TCA['tt_content']['columns']['pi_flexform']['config']['ds']['YOUR_EXTENSION_pi1,list'] by a value that your admin sets in a page config. t3lib_BEfunc::getModTSconfig() should let you load page config and it's up to you to decide what key you will be looking for.
NOTE: This is untested theory but its principle is based on one of my custom extensions where I modify TCA on the fly.
Have a look at EXT:flux. Claus did that already.
https://github.com/FluidTYPO3/flux

How to override a user profile view,, in our own plugin, in elgg

I have created a new plugin named 'adv' in my elgg site.
And in this plugin iam listing the users.Which using the view from other elgg plugin 'profile
ie the page profile/views/default/profile/listing.php.
Now i need to set a link in the existing view of each user.So i have to edit the profile plugin , mainly the page profile/views/default/profile/listing.php
But how can i do this, without modifying elggs default plugin 'profile'.
I have tried a method that i have copied the folder 'profile' from profile/views/default/profile and put it in adv/views/default/.But it donot working.]
Is any solution for adding new link to the user view with editing other plugin, only editing our own plugin example 'adv'.
You'll need to override the profile/listing view, but only when Elgg is rendering your plugin's pages, not to interfere with other plugins that might want to use the core profile/listing view.
My approach to this problem is the following:
Create a new directory that will hold the views that you want to override.
In your case, I'd create the "adv/views/mod" directory within your_site_root/mod.
Add the view you'd like to override into this directory.
Again, your case, copy the profile/views/default/profile/listing.php to the following location: adv/views/mod/default/profile/listing.php
Make your modifications to the newly created view.
You can now safely modify the adv/views/mod/default/profile/listing.php file to your liking
Tell Elgg to use the special view when your plugin is rendering the page. This means you'll have to call the set_view_location(..) method either from your page_handler function, or the php files that are referenced by your page_handler and usually prepare the data for the views (like index.php or read.php, but I don't know your plugin's file hierarchy)
So in your case you'd call set_view_location('profile/listing', $CONFIG->pluginspath . 'adv/views/mod/'); either from your page_handler or from one of the above files.
Make sure that $CONFIG is present and available by referencing it (global $CONFIG).
Please check if "Use view filepath cache (recommended)", is disabled in the site administration. Because elgg uses hard view cache. Or delete the view_cache file from the data directory. And also make user your plugin is below the "Profile" in the plugin list.

Categories