Custom Ajax file in Joomla

<?php
    define('_JEXEC', 1);
    define('JPATH_BASE', realpath(dirname(__FILE__) . '/../../'));  
    require_once JPATH_BASE . '/includes/defines.php';
    require_once JPATH_BASE . '/includes/framework.php';

    $mainframe = JFactory::getApplication('site');
$db = JFactory::getDBO();
 $query = "SELECT distinct `customfield_value` FROM `jos_virtuemart_product_customfields` WHERE `virtuemart_custom_id` = '17'";
 //echo $query;
 $db->setQuery($query);
 $result = $db->loadObjectList();
 
 echo '<pre>';
 print_r($result);
 echo '</pre>';
?>
Read More
Joomla, PHP

Controller Actions Dataobjects as Pages in Silver Stripe

What we’ll cover

  • What are controller actions, and how are they used?
  • Create a controller action to render a DataObject
  • Rendering a DataObject as a page
  • Adding pseudo-page behaviour to a DataObject

How controller actions work

Up to this point in our project, for the most part, every page has been on a single URL, which that URL points to a single controller, which renders a single $Layout template. However, if you think back to our lesson on forms, you may remember that we were able to extend the URL route for our controller in order to generate and render a form. We did this using a controller action. Forms are just one of many use cases for a controller action.

Using controller actions is simple...

Read More
PHP, Silver Stripe

Upgraded to Joomla 3.7 And Component Menu Items Disapeared

Steps to reproduce the issue

Upgraded manually to Joomla 3.7
Discovered upgrades and updated database
Cleared cache and made all Joomla components active
Was replicated on three different joomla upgrade websites

Expected result

Admin menu for components should not have changed

Actual result

Components menu made certain items like contacts and joomla upgrade disappear. Inconsistent menu items disappeared across the three websites – If I manually go to the url of the missing components, they still work, but they’re just gone in the admin menu.

Was that solved in 3.7.3? I just upgraded multiple sites (25 in total) from 3.7.2 to 3.7.3 and found out that some entries in the menu where missing...
Read More
Joomla, PHP

Adding Google Adsense ads to Joomla 3.x

Advertising on your site using Google Adsense is a simple way to earn money from your site visitors. This tutorial will describe how to place a Google Adsense ad on your Joomla! 3.1 site.

You will need the following:

  • The location on your site where you will be placing your ad. This depends entirely on how you want the ad to look (tall and skinny, short and wide, a box, etc.) and where the template you are using for your content pages has room.
  • A Google Adsense account (http://adsense.google.com). In this account you should have created an ad of the size you want. I have several ads I use, the one I’m using in this tutorial is 120 pixels wide by 620 high.

In this example, the template I am using (Pixeldot from freshjoomlatemplates.com) has a position labeled as “right” on the template...

Read More
Joomla, PHP

MySql Query for Codeigniter

Select Query

$clearEmiSql = “SELECT * FROM `tbl_mortgage_new_emi` WHERE `ID` >= ‘”.$emi_no.”‘ AND `emi_clear` = ‘1’ AND `mortgage_id` = ‘”.$mort_id.”‘”;
$clearEmiSql = $this->db->query($clearEmiSql);
$clearEmiResData = $clearEmiSql->result_array();

echo $this->db->last_query(); die;

Insert Query

$data_newEmi = array(
‘total_emi’=>$emi_amount,
‘mortgage_id’=>$mort_id,
’emi_date’=>$date_new
);
$this->mortgage_model->insert(‘tbl_mortgage_new_emi’, $data_newEmi);

Delete and Update Query

$sqlDeleteRow = “Delete from `tbl_mortgage_new_emi` where `mortgage_id` = ‘”.$mort_id.”‘ order by `ID` desc limit 1″;
$this->db->query($sqlDeleteRow);

Read More
Codeigniter, PHP

Change or Translate Text on a WordPress Theme

You may want to replace a line or two of text on your WordPress Theme. You can easily change or translate a text by adding this code on your WordPress Functions. If what you’re after is to actually translate the entire theme and not just a couple of words then read this post instead: How to add Language Files on a WordPress Child Theme

This code makes use of the gettext function. Replace Old Text with the string you want to change. This is case-sensitive so type it exactly as you see it on your WordPress Theme. Replace New Translation with your new text replacement. You can leave it blank if you want to remove the original text.

To change or translate a single string, add this code on your functions.php.

 
function ra_change_translate_text( $translated_text ) {
if ( $translated_text == ...

Read More
PHP, Wordpress

How to Install Laravel

http://www.wikihow.com/Install-Laravel-Framework-in-Windows

  1. Install Laravel Framework in Windows *PHP version greater than 5.3.7 is required...
  2.  Download Laravel from: www.github.com/laravel/laravel/archive/master.zip
  3. Extract Laravel into the www folder for WAMP (www.wampserver.com).
  4. Download Composer from: www.getcomposer.org/Composer-Setup.exe
  5. Enable openssl from all php.ini files.
  6. Install Composer into the same directory php.exe is located.
  7. Click on WAMP icon->PHP->PHP Extensions and enable: php_openssl, php_curl, php_sockets.
  8. Click on wamp icon->Apache->Apache Modules and enable ssl_module
  9. Open cmd.
  10. Change into the directory where you extracted Laravel e.g: cd C:\wamp\www\laravel.
  11. Type the command: composer install.
  12. Click on wamp icon->Apache->Apache Modules and enable rewrite_mo...
Read More
PHP

Magento: How to check if current page is homepage?

Here is a quick Magento code to check if the current page is homepage or not.

If you are in template/page/html/header.phtml template file, then you can check for homepage with the following code:

Read More
Magento

Submitting Your First Request in Product Advertising API

To submit your first request to Product Advertising API

  1. Go to the Product Advertising API Scratchpad.
  2. Choose an operation, for example ItemSearch.
  3. Under Common parameters, choose your marketplace and type your credentials.
  4. Choose your request parameters. For example, for the Keywords parameter, type “Harry Potter” and then click Run request.
  5. Under Request URL, your unsigned and request URL appear.
  6. Under Response, locate your response examples.

Congratulations! You just made your first Product Advertising API request.

Read More
PHP

How to create a signed request to the Amazon Product Advertising API in PHP

A demonstration of how to create a signed request for access to the Amazon product advertising API in PHP for use with ItemSearch or ItemLookup.

To access the Amazon product advertising API you’re going to need to create a signed URL per each request, which you can then later work with. You’ll need to have the 3 codes below before reading any further as without these you cannot sign the request and will be unable to access the API.

  1. AssociateTag
  2. AWSAccessKeyId
  3. AWS Secret Key

You can find out more information about how to get the above here.

Once you’ve got the above codes, you’re ready to create a signed URL and begin accessing Amazons vast product library. I’ve wrapped all the necessary code into a function for you, which you can find at the bottom of this page and for now the only parts...

Read More
PHP