/
products.php
executable file
·79 lines (72 loc) · 2.17 KB
/
products.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
/**
* $Desc
*
* @version $Id$
* @package wpbase
* @author Opal Team <opalwordpressl@gmail.com >
* @copyright Copyright (C) 2014 wpopal.com. All Rights Reserved.
* @license GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
*
* @website http://www.wpopal.com
* @support http://www.wpopal.com/support/forum.html
*/
if(class_exists('WooCommerce')){
class WPO_Shortcode_Products extends WPO_Shortcode_Base{
public function __construct( ){
// add hook to convert shortcode to html.
$this->name = str_replace( 'wpo_shortcode_','',strtolower( __CLASS__ ) );
$this->key = 'wpo_'.$this->name;
parent::__construct( );
}
/**
* $data format is object field of megamenu_widget record.
*/
public function getButton( $data=null ){
$button = array(
'icon' => 'image',
'title' => $this->l( 'Products' ),
'desc' => $this->l( 'Display Products' ),
'name' => $this->name
);
return $button;
}
public function getOptions( ){
$this->options[] = array(
"type" => "text",
"label" => __("Title", TEXTDOMAIN),
"id" => "title",
"default" => ''
);
$this->options[] = array(
'label' => $this->l('Type'),
'id' => 'type',
'type' => 'select',
'options' => array(
'top_rate' => 'Top Rate',
'recent_product' => 'Recent Products',
'featured_product' => 'Featured Products',
'best_selling' => 'Best Selling'
)
);
$this->options[] = array(
'label' => $this->l('Layout'),
'id' => 'layout',
'type' => 'select',
'options' => array('Grid'=>'grid', 'List'=>'list')
);
$this->options[] = array(
'label' => $this->l('Columns count'),
'id' => 'columns_count',
'type' => 'select',
'options' => array('4'=>4, '3'=>3, '2'=>2, '1'=>1)
);
$this->options[] = array(
"type" => "text",
"label" => __("Number of products to show", TEXTDOMAIN),
"id" => "number",
"default" => '4'
);
}
}
}