Skip to content

Instantly share code, notes, and snippets.

View chetanmadaan's full-sized avatar

Chetan Madaan chetanmadaan

View GitHub Profile
@chetanmadaan
chetanmadaan / hikashop.php
Created February 16, 2021 14:34
Hikashop.php finder plugin for Joomla fix for excluding duplicates in search results of products that are in multiple categories
protected function getListQuery($query = null)
{
$db = JFactory::getDbo();
$query = $query instanceof JDatabaseQuery ? $query : $db->getQuery(true)
->select('a.product_id AS id, a.product_name AS title, a.product_alias AS alias, "" AS link, a.product_description AS summary')
->select('a.product_keywords AS metakey, a.product_meta_description AS metadesc, "" AS metadata, a.product_access AS access')
->select('"" AS created_by_alias, a.product_modified AS modified, "" AS modified_by')
->select('a.product_sale_start AS publish_start_date, a.product_sale_end AS publish_end_date')
->select('a.product_published AS state, a.product_sale_start AS start_date, 1 AS access')
->select('brand.category_name AS brand, brand.category_alias as brandalias, brand.category_published AS brand_state, 1 AS brand_access')
@chetanmadaan
chetanmadaan / functions.php
Created February 15, 2021 16:09
Post to WebHook on event booking/registration for eventsmanagerpro WP
function my_offline_auto_approve_filter( $result, $EM_Booking ){
$event = [
'eventname' => $EM_Booking->event->event_name,
'event_id' => $EM_Booking->event->event_id,
'post_id' => $EM_Booking->event->post_id,
'post_content' => $EM_Booking->event->post_content,
'start_time' => $EM_Booking->event->start_time,
'start_date' => $EM_Booking->event->start_date,
'end_date' => $EM_Booking->event->end_date,
'end_time' => $EM_Booking->event->end_time,
@chetanmadaan
chetanmadaan / hubspotmappings.json
Last active September 28, 2020 18:43
hubspot Ecommerce Bride Joomla mappings
{
"enabled": true,
"mappings": {
"CONTACT": {
"properties": [
{
"externalPropertyName": "firstname",
"hubspotPropertyName": "firstname",
"dataType": "STRING"
},
@chetanmadaan
chetanmadaan / social-links.php
Created April 29, 2020 20:00
Overriding Layouts with JD Builder.
@chetanmadaan
chetanmadaan / formatphone.php
Last active March 12, 2020 18:34
Phone Formatted in US format
<?php
if(!empty($phone)) {
$formatedphone = "(" . substr($phone, 0, 3) . ") " . substr($phone, 3, 3) . "-" . substr($phone, 6);
}
?>
@chetanmadaan
chetanmadaan / .htaccess
Created February 27, 2020 21:43
.htaccess redirect thingy.
# Redirect HTTP with www to HTTPS with www
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Redirect HTTP without www to HTTPS with www
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Redirect HTTPS without www to HTTPS with www
RewriteCond %{HTTPS} on
@chetanmadaan
chetanmadaan / deletearticleviaapi.php
Created November 11, 2019 04:27
Delete article via Joomla 4 API
<?php
// Enter the path of your Joomla site.
$baseurl = 'http://localhost/j4a12';
// Joomla Super Admin Credentials
$user = 'admin';
$pass = 'admin';
// Article id to Delete
$articleid = 15;
@chetanmadaan
chetanmadaan / createarticleviajoomlaapi.php
Created November 11, 2019 04:11
Create article via Joomla 4 API
<?php
// Enter the path of your Joomla site.
$baseurl = 'http://localhost/j4a12';
// Joomla Super Admin Credentials
$user = 'admin';
$pass = 'admin';
// Content of the Article
$article = new stdClass();
@chetanmadaan
chetanmadaan / accesssinglearticleresponse.json
Last active November 11, 2019 03:44
Access single article response - Joomla 4 API
{
"links": {
"self": "http://localhost/j4a12/api/index.php/v1/content/article/6"
},
"data": {
"type": "articles",
"id": "6",
"attributes": {
"typeAlias": "com_content.article",
"id": 6,
@chetanmadaan
chetanmadaan / accessinglearticle.php
Created November 11, 2019 03:41
Access Single article - Joomla 4 API
<?php
// Enter the path of your Joomla site.
$baseurl = 'http://localhost/j4a12';
// Joomla Super Admin Credentials
$user = 'admin';
$pass = 'admin';
// ID of the article you want to access
$articleid = 6;
// No Edits below this line needed.
$curl = curl_init();