Skip to content

Instantly share code, notes, and snippets.

<?php
/**
*
* You can find the complete tutorial for this here:
* https://pluginrepublic.com/woocommerce-custom-fields
*
* Alternatively, check out the plugin
* https://pluginrepublic.com/wordpress-plugins/woocommerce-product-add-ons-ultimate/
*
@mrmoyeez
mrmoyeez / plugins.php
Created September 14, 2021 07:06 — forked from anonymous/plugins.php
Add extra info to WooCommerce product
<?php
/**
* Plugin Name: Pharmacy
* Plugin URI: http://domain.com
* Description: Add extra info for pharmacy products
* Author: Your name
* Author URI: http:// domain.com
* Version: 1.0
*/
<?php
namespace Company\Module\Block\Product\ProductList;
class Toolbar extends \Magento\Catalog\Block\Product\ProductList\Toolbar
{
public function setCollection($collection) {
$this->_collection = $collection;
$this->_collection->setCurPage($this->getCurrentPage());
@mrmoyeez
mrmoyeez / sort-by-discount.php
Created December 9, 2019 06:53 — forked from EricBusch/sort-by-discount.php
Add "Sort by discount" to sorting options. Defaults to biggest to smallest discount.
<?php
/**
* Add "Sort by discount" to sorting options. Defaults to biggest to smallest discount.
*/
add_filter( 'woocommerce_get_catalog_ordering_args', 'mycode_woocommerce_add_salediscount_to_catalog_ordering_args' );
function mycode_woocommerce_add_salediscount_to_catalog_ordering_args( $args ) {
$orderby_value = isset( $_GET['orderby'] ) ? woocommerce_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) );
if ( 'discount' == $orderby_value ) {
$args['orderby'] = 'meta_value_num';
@mrmoyeez
mrmoyeez / export_categories.php
Created December 3, 2019 11:48 — forked from bluec/export_categories.php
Export Magento category tree with full names, paths and URLs
<?php
define('MAGENTO', realpath(dirname(__FILE__)));
require_once MAGENTO . '/app/Mage.php';
Mage::app();
$category = Mage::getModel('catalog/category');
$tree = $category->getTreeModel();
$tree->load();
@mrmoyeez
mrmoyeez / CategoryTreePathExportMagento.php
Created December 3, 2019 11:48 — forked from tegansnyder/CategoryTreePathExportMagento.php
Export Category Tree and Paths for Magento
<?php
define('MAGENTO', realpath(dirname(__FILE__)));
require_once MAGENTO . '/app/Mage.php';
Mage::app();
$category = Mage::getModel ('catalog/category');
$tree = $category->getTreeModel();
$tree->load();
@mrmoyeez
mrmoyeez / media-query.css
Created September 6, 2019 11:08 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
@mrmoyeez
mrmoyeez / faceapp.js
Created October 13, 2018 06:42 — forked from CyberFerret/faceapp.js
Face recognition demo - App js file
$(document).ready(function() {
if (window.JpegCamera) {
var camera; // placeholder
// Add the photo taken to the current Rekognition collection for later comparison
var add_to_collection = function() {
var photo_id = $("#photo_id").val();
if (!photo_id.length) {
@mrmoyeez
mrmoyeez / functions.php
Created September 8, 2018 13:37 — forked from daithi-coombes/functions.php
To enable 'price from' and 'price to' search for wordpress [WP Property Plugin](https://usabilitydynamics.com/products/wp-property/forum/topic/price-range-search/)
/**
* Rename these to the form input names you are going to use.
* When you create a new attribute in Properties->Settings->Developer
* the form input name will appear greyed out under the attribute name
*/
define('SPRP_SEARCH_FROM_KEY', 'price_from_per_month');
define('SPRP_SEARCH_TO_KEY', 'price_to_per_month');
function parse_search(){
@mrmoyeez
mrmoyeez / bp-xprofile-countries-list.php
Created July 13, 2018 11:45 — forked from slaFFik/bp-xprofile-countries-list.php
BuddyPress xProfile - Add Countries
<?php
/**
* If you are using BP 2.1+, this will insert a Country selectbox.
* Add the function to bp-custom.php and then visit .../wp-admin/users.php?page=bp-profile-setup
*/
function bp_add_custom_country_list() {
if ( !xprofile_get_field_id_from_name('Country') && 'bp-profile-setup' == $_GET['page'] ) {