for what purpose # (hash) sign is used in Joomla? - joomla

In joomla MVC i came around this SQL query. I was unable to understand the purpose of #sign ??
INSERT INTO `#__helloworld` (`greeting`) VALUES
('Hello World!'),
('Good bye World!');

It is replaced by the prefix for that installation when it is run. This way you can have multiple Joomla installations running in the same database, as long as they all have different prefixes. You can find the prefix for your installation in the Global Settings as well as in the configuration.php file.
The entire #__ part is necessary for the replace to work properly. So just a # will not work as intended.
*Note that this is a Joomla specific construct, so don't expect this to work with just PHP/MySQL. It will work for all Joomla versions and is highly recommended.

As you know there is a random 4 or 5 character lentgh table prefix for joomla database tables. This is made for increasing security. Joomla is an opensource content management system, so malicious attackers know what tables exist. You cannot change the table names (or this would takes too long), so adding a prefix for the table names is a nice solution.
#__ part of the table name is replaced with table prefix which has been defined while installing joomla when the code is processed. Also you can see the table prefix in configuration.php or from the administrator panel
Follow Global Configuration -> Server -> Database order.

#__ replace with tables prefix (defines in configuration) before execute query
Joomla and MySQL

Related

How to duplicate Magento CMS pages and content blocks for additional language scopes

I neeed to find out if it is possible to duplicate a content block or page in Magento much in the same way that you can with products?
For example, I can create a product in (English) and then select an alternative language scope (Italian) and paste the text in for the Italian version.
That is intuitive.
Is this possible for CMS pages and Blocks? It does not appear to be - but maybe I am missing something?
I navigate to CMS > Pages and select a page to edit, it just looks to offer the ability to change the language allocation (not duplicate it for alternative scopes).
It's not possible to duplicate CMS blocks within the Magento admin.
There are a number of extensions that will add this function or alternatively ones that allow you to export, amend in CSV and then import to create the duplicate pages or static blocks quickly.
The CMS Blocks in Magento 2.x are stored in 2 tables:
cms_block
cms_block_store
You can export the cms_block table directly from the mysql db and change what ever you want with an external editor like open-office calc (in my opinion better than excell for export to csv) delete teh column with the id and import again.
If you are implementing a multiple website/store magento then you will need to also export/import the cms_page_store with the correct id's of the block and the store

Joomla: regenerate aliases for all articles at once?

I am working on a Joomla 3.2.1 site and the client, without thinking, entered in the same alias for all articles, instead of letting the system use the article title. So now if I want to turn on SEF URL's we are going to have 404 issues in the future.
I want to resave or regenerate all article aliases at once (batch).
Is there a way to do it? in the MYSQL DB maybe?
Thank you in advance.
$alias = JApplication::stringURLSafe($article->title);
Joomla will generate the alias when saving the article. I am not aware of any batch joomla feature to regenerate all the aliases and I would also be interested to know about this.
If no other batch solution exists, you should do manually the updates to these fields.
In the database, you could run update queries for all your articles, but you must type each update query one by one.
The update query for a single row would look like:
UPDATE jos_content
SET alias='my-new-alias-name'
WHERE id='{id-of-the-article}'
For multiple rows at once, you could do something like this:
UPDATE jos_content
SET alias = CASE id
WHEN 1 THEN 'alias1'
WHEN 2 THEN 'alias2'
WHEN 3 THEN 'alias3'
END
WHERE id IN (1,2,3)
What you could do is delete the alias data from all of your articles in the database using mysql. Then make a tag, like "fixalias." Using the batch processing feature tag all of the articles with that tag.
This will run store() for all of your articles and automatically generate the aliases. Then delete the tag from the tag manager.you ar
A similar strategy would involve also deleting all the aliases but batch moving (don't copy) your articles to a temporary category and then moving them back.

Oracle NLS function/settings file location

I am working on a Oracle Jdeveloper project that was made by another person which I can no longer contact. On the code he uses this: nls['NO_ROWS_FOUND'].
I have made some searches and I found that this goes to file that stores oracle environment variables for language translations and loads the corresponding value for that key variable. (Not sure if this is true).
What I would like to know is how can I find this file, or where are these values stored? Can I had diferent translations?
He is using this to enter text on a Label.
Thanks
Best Regards

Magento coupon entities in database

I'm trying to develop a Magento plugin which involves using coupons. Apparently after looking around I found a source that mentions use of a 'salesrule' table for coupons. However when I looked at my database i couldn't find it. However I did find 3 tables that had mention 'coupon' called 'coupon_aggregated', 'coupon_aggregated_order', and 'coupon_aggregated_updated'.
I just wanted to know what is the difference between the 3 tables so I can start using them? I am on the latest version of Magento.
The table you're looking for is indeed named
salesrule
There's also a table named salesrule_coupon, which contains specific coupon codes linked back to the main salesrule definition.
If your database is missing this table, something bad has happened to your system. Go to
Promotions -> Shopping Cart Price Rules
and create a new coupon code with a distinct title. Then dump your database content and search for the text of your distinct title. That will let you know which table your system is storing salesrules in.
The tables you mentioned above are aggregate data tables used for reporting only.

Magento - Store Config only added to database after being saved

I have noticed that in Magento the core_config_data table is very small just after installation and it gradually gets populated over time ONLY when sections of the system config are saved. For example there are no values in the core_config_data table for the contacts settings - yet i can still do Mage::getStoreConfig('contacts/contacts/enabled') and get the correct value.
So, does this mean that magento is simply reading the config xml until a value is saved, and at which point it saves to the database and then the value is read from there?
If this is the case, then surely this is a bad design pattern, having these values stored in two places?
I think this post may help.
The Magento Config: Loading System Variables

Resources