-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.php
101 lines (81 loc) · 2.89 KB
/
test.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
include 'app/Mage.php';
Mage::app();
$orderAmount = (int)Mage::helper('adyen')->formatAmount(0.01, 'EUR');
var_dump($orderAmount);
/*
echo md5('linglovehuang');
exit();
*/
include 'app/Mage.php';
Mage::app();
//Mage::log('test',null,'test.log');
//echo date('Y-m-d H:i:s',time());
if (isset($_SERVER['HTTP_CLIENT_IP'])) {
$ipaddress = $_SERVER['HTTP_CLIENT_IP'];
} elseif(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
} elseif(isset($_SERVER['HTTP_X_FORWARDED'])) {
$ipaddress = $_SERVER['HTTP_X_FORWARDED'];
}elseif(isset($_SERVER['HTTP_FORWARDED_FOR'])) {
$ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
} elseif(isset($_SERVER['HTTP_FORWARDED'])) {
$ipaddress = $_SERVER['HTTP_FORWARDED'];
} elseif(isset($_SERVER['REMOTE_ADDR'])) {
$ipaddress = $_SERVER['REMOTE_ADDR'];
} else {
$ipaddress = '';
}
var_dump($ipaddress);
/*
//echo Mage::getSingleton('core/date')->gmtTimestamp('2017-11-08 02:06:42');
//echo 'php time: '.date('Y-m-d H:m:s').'<br/>';
$startTime = '2017/11/27 10:15:00';
if($startTime<='2017/11/25 17:15:00'){
$endTime = '2017/11/25 17:15:00';
}elseif($startTime<='2017/11/26 17:15:00'){
$endTime = '2017/11/26 17:15:00';
}elseif($startTime<='2017/11/27 17:15:00'){
$endTime = '2017/11/27 17:15:00';
}
var_dump($endTime);
exit();
$test = Mage::getModel('directory/currency')->getCurrencyRates('EUR','USD');
Mage::app()->getStore()->getBaseCurrency();
echo Mage::app()->getStore(5)->getCurrentCurrencyCode();
exit();
$product = Mage::getModel('catalog/product')->load(172);
$test = $product->getCategoryIds();
var_dump($test);
exit();
$store_id=2;
$adapter = Mage::getModel('core/resource')->getConnection('core_read');
$hot_result = $adapter->query("select product_id from sales_flat_order_item where store_id=".$store_id." group by product_id order by count(product_id) desc limit 50");
$rows = $hot_result->fetchAll();
foreach($rows as $key=>$row){
if($key==0){
$in_str = $row['product_id'];
}else{
$in_str = $in_str.','.$row['product_id'];
}
$rows[$key] = $row['product_id'];
}
$collection = Mage::getResourceModel('catalog/product_collection')
->setStore($store_id);
$date = time()-10*24*3600;
$date = date('Y-m-d H:i:s',$date);
$select = $collection->getSelect()
->where("e.created_at>'".$date."' or e.entity_id in (".$in_str.")");
print_r((string)$collection->getSelect());
exit();
$products = Mage::getResourceModel('catalog/product_collection')
->setStore($store_id)
->addAttributeToSelect('*')
->addStoreFilter($store_id)
->setPageSize($batch_max)
->setCurPage($count / $batch_max + 1)
->addUrlRewrite();
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
print_r((string)$products->getSelect());
*/