Version Notes
This is Stable version
Download this release
Release Info
Developer | Globalshopex |
Extension | GSXInternationalCheckoutWithIframe |
Version | 1.2.0 |
Comparing to | |
See all releases |
Version 1.2.0
- app/code/community/GSX/InternationalCheckout/Block/International.php +494 -0
- app/code/community/GSX/InternationalCheckout/Helper/Data.php +4 -0
- app/code/community/GSX/InternationalCheckout/Model/International.php +8 -0
- app/code/community/GSX/InternationalCheckout/Model/Servers.php +15 -0
- app/code/community/GSX/InternationalCheckout/Model/Shippingmethods.php +29 -0
- app/code/community/GSX/InternationalCheckout/controllers/CheckoutController.php +21 -0
- app/code/community/GSX/InternationalCheckout/controllers/InvoiceController.php +37 -0
- app/code/community/GSX/InternationalCheckout/controllers/TrackingController.php +21 -0
- app/code/community/GSX/InternationalCheckout/etc/config.xml +50 -0
- app/code/community/GSX/InternationalCheckout/etc/system.xml +88 -0
- app/design/frontend/base/default/layout/internationalcheckout.xml +18 -0
- app/design/frontend/base/default/template/internationalcheckout/Login.phtml +17 -0
- app/design/frontend/base/default/template/internationalcheckout/contentCheckout.phtml +106 -0
- app/design/frontend/base/default/template/internationalcheckout/contentInvoice.phtml +17 -0
- app/design/frontend/base/default/template/internationalcheckout/contentTracking.phtml +22 -0
- app/design/frontend/base/default/template/internationalcheckout/international.phtml +115 -0
- app/etc/modules/GSX_InternationalCheckout.xml +12 -0
- media/GSX/images/default/gc_button.gif +0 -0
- package.xml +18 -0
app/code/community/GSX/InternationalCheckout/Block/International.php
ADDED
@@ -0,0 +1,494 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class GSX_InternationalCheckout_Block_International extends Mage_Core_Block_Template {
|
3 |
+
|
4 |
+
public $GC_URL = "http://globalshopex.com/shoppingCart.asp";
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Returns true only if name_of_company and shipping_method have been defined and Enabled is set to Yes.
|
8 |
+
*
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
+
function isEnabled() {
|
14 |
+
|
15 |
+
$isValid = false;
|
16 |
+
$sm_config = trim(Mage::getStoreConfig("checkout/internationalcheckout/shipping_method"));
|
17 |
+
|
18 |
+
if ((trim(Mage::getStoreConfig("checkout/internationalcheckout/name_of_company")) != "") && ($sm_config != "") && Mage::getStoreConfig("checkout/internationalcheckout/active") ) {
|
19 |
+
|
20 |
+
$sm = explode("_",$sm_config);
|
21 |
+
if ( Mage::getStoreConfig('carriers/'.$sm[0].'/active') || $sm[0] == 'freedomesticshippingtogsx' ) {
|
22 |
+
$isValid = true;
|
23 |
+
}
|
24 |
+
}
|
25 |
+
return $isValid;
|
26 |
+
}
|
27 |
+
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Returns name_of_company after removing spaces and converting to lower case.
|
31 |
+
*
|
32 |
+
*/
|
33 |
+
|
34 |
+
function formatCompany($cName) {
|
35 |
+
$cName = str_replace(" ","",$cName);
|
36 |
+
$cName = strtolower($cName);
|
37 |
+
return $cName;
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Returns CSS style attribute filled with image info.
|
42 |
+
*
|
43 |
+
*/
|
44 |
+
|
45 |
+
function buttonImagePath() {
|
46 |
+
|
47 |
+
$style = "";
|
48 |
+
$style= "style=\"background-image:url('".Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA)."GSX/images/default/gc_button.gif"."'); background-repeat:no-repeat; background-color:transparent; height:27px; width:232px; outline:none; border:none; cursor:pointer;\"";
|
49 |
+
return $style;
|
50 |
+
}
|
51 |
+
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Returns text for GSX button.
|
55 |
+
*
|
56 |
+
*/
|
57 |
+
|
58 |
+
function buttonText() {
|
59 |
+
|
60 |
+
if (trim(Mage::getStoreConfig("checkout/internationalcheckout/gsx_button_image")) != "") {
|
61 |
+
return "";
|
62 |
+
}
|
63 |
+
else {
|
64 |
+
|
65 |
+
return $this->__('Global Checkout');
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
|
70 |
+
/*
|
71 |
+
* getBundleOptions - Mage_Bundle_Block_Checkout_Cart_Item_Renderer
|
72 |
+
*
|
73 |
+
*/
|
74 |
+
protected function _getBundleOptions($item, $useCache = true)
|
75 |
+
{
|
76 |
+
$options = array();
|
77 |
+
|
78 |
+
/**
|
79 |
+
* @var Mage_Bundle_Model_Product_Type
|
80 |
+
*/
|
81 |
+
$typeInstance = $item->getProduct()->getTypeInstance(true);
|
82 |
+
|
83 |
+
// get bundle options
|
84 |
+
$optionsQuoteItemOption = $item->getOptionByCode('bundle_option_ids');
|
85 |
+
$bundleOptionsIds = unserialize($optionsQuoteItemOption->getValue());
|
86 |
+
if ($bundleOptionsIds) {
|
87 |
+
/**
|
88 |
+
* @var Mage_Bundle_Model_Mysql4_Option_Collection
|
89 |
+
*/
|
90 |
+
$optionsCollection = $typeInstance->getOptionsByIds($bundleOptionsIds, $item->getProduct());
|
91 |
+
|
92 |
+
// get and add bundle selections collection
|
93 |
+
$selectionsQuoteItemOption = $item->getOptionByCode('bundle_selection_ids');
|
94 |
+
|
95 |
+
$selectionsCollection = $typeInstance->getSelectionsByIds(
|
96 |
+
unserialize($selectionsQuoteItemOption->getValue()),
|
97 |
+
$item->getProduct()
|
98 |
+
);
|
99 |
+
|
100 |
+
$bundleOptions = $optionsCollection->appendSelections($selectionsCollection, true);
|
101 |
+
foreach ($bundleOptions as $bundleOption) {
|
102 |
+
if ($bundleOption->getSelections()) {
|
103 |
+
$option = array('label' => $bundleOption->getTitle(), "value" => array());
|
104 |
+
$bundleSelections = $bundleOption->getSelections();
|
105 |
+
|
106 |
+
foreach ($bundleSelections as $bundleSelection) {
|
107 |
+
$option['value'][] = $this->_getSelectionQty($item, $bundleSelection->getSelectionId()).' x '. $this->htmlEscape($bundleSelection->getName()). ' ' .Mage::helper('core')->currency($this->_getSelectionFinalPrice($item, $bundleSelection));
|
108 |
+
}
|
109 |
+
|
110 |
+
$options[] = $option;
|
111 |
+
}
|
112 |
+
}
|
113 |
+
}
|
114 |
+
return $options;
|
115 |
+
}
|
116 |
+
|
117 |
+
|
118 |
+
function _getSelectionFinalPrice($item, $selectionProduct)
|
119 |
+
{
|
120 |
+
$bundleProduct = $item->getProduct();
|
121 |
+
return $bundleProduct->getPriceModel()->getSelectionFinalPrice(
|
122 |
+
$bundleProduct, $selectionProduct,
|
123 |
+
$item->getQty(),
|
124 |
+
$this->_getSelectionQty($item, $selectionProduct->getSelectionId())
|
125 |
+
);
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Get selection quantity
|
130 |
+
*
|
131 |
+
*/
|
132 |
+
function _getSelectionQty($item, $selectionId)
|
133 |
+
{
|
134 |
+
if ($selectionQty = $item->getProduct()->getCustomOption('selection_qty_' . $selectionId)) {
|
135 |
+
return $selectionQty->getValue();
|
136 |
+
}
|
137 |
+
return 0;
|
138 |
+
}
|
139 |
+
|
140 |
+
|
141 |
+
|
142 |
+
/**
|
143 |
+
* get product attributes
|
144 |
+
*
|
145 |
+
*/
|
146 |
+
|
147 |
+
function getProductAttributes($item)
|
148 |
+
{
|
149 |
+
$attributes = $item->getProduct()->getTypeInstance(true)
|
150 |
+
->getSelectedAttributesInfo($item->getProduct());
|
151 |
+
return $attributes;
|
152 |
+
}
|
153 |
+
|
154 |
+
|
155 |
+
|
156 |
+
function getLinks($item)
|
157 |
+
{
|
158 |
+
$itemLinks = array();
|
159 |
+
if ($linkIds = $item->getOptionByCode('downloadable_link_ids')) {
|
160 |
+
$productLinks = $item->getProduct()->getTypeInstance(true)
|
161 |
+
->getLinks($item->getProduct());
|
162 |
+
foreach (explode(',', $linkIds->getValue()) as $linkId) {
|
163 |
+
if (isset($productLinks[$linkId])) {
|
164 |
+
$itemLinks[] = $productLinks[$linkId];
|
165 |
+
}
|
166 |
+
}
|
167 |
+
}
|
168 |
+
return $itemLinks;
|
169 |
+
}
|
170 |
+
|
171 |
+
|
172 |
+
function getLinksTitle($item)
|
173 |
+
{
|
174 |
+
if ($item->getProduct()->getLinksTitle()) {
|
175 |
+
return $item->getProduct()->getLinksTitle();
|
176 |
+
}
|
177 |
+
return Mage::getStoreConfig(Mage_Downloadable_Model_Link::XML_PATH_LINKS_TITLE);
|
178 |
+
}
|
179 |
+
|
180 |
+
|
181 |
+
function getChildProduct($item)
|
182 |
+
{
|
183 |
+
if ($option = $item->getOptionByCode('simple_product')) {
|
184 |
+
return $option->getProduct();
|
185 |
+
}
|
186 |
+
return $item->getProduct();
|
187 |
+
}
|
188 |
+
|
189 |
+
function getGroupedProduct($item)
|
190 |
+
{
|
191 |
+
$option = $item->getOptionByCode('product_type');
|
192 |
+
if ($option) {
|
193 |
+
return $option->getProduct();
|
194 |
+
}
|
195 |
+
return $item->getProduct();
|
196 |
+
}
|
197 |
+
|
198 |
+
|
199 |
+
|
200 |
+
function getProductThumbnail($item)
|
201 |
+
{
|
202 |
+
|
203 |
+
// begin configurable
|
204 |
+
if ($item->getProduct()->isConfigurable()) {
|
205 |
+
$product = $this->getChildProduct($item);
|
206 |
+
if (!$product || !$product->getData('thumbnail')
|
207 |
+
|| ($product->getData('thumbnail') == 'no_selection')
|
208 |
+
|| (Mage::getStoreConfig(Mage_Checkout_Block_Cart_Item_Renderer_Configurable::CONFIGURABLE_PRODUCT_IMAGE) == Mage_Checkout_Block_Cart_Item_Renderer_Configurable::USE_PARENT_IMAGE)) {
|
209 |
+
$product = $item->getProduct();
|
210 |
+
}
|
211 |
+
return Mage::helper('catalog/image')->init($product, 'thumbnail');
|
212 |
+
}
|
213 |
+
// end configurable
|
214 |
+
|
215 |
+
// begin grouped
|
216 |
+
if ($item->getProduct()->isGrouped()) {
|
217 |
+
$product = $item->getProduct();
|
218 |
+
if (!$product->getData('thumbnail')
|
219 |
+
||($product->getData('thumbnail') == 'no_selection')
|
220 |
+
|| (Mage::getStoreConfig(Mage_Checkout_Block_Cart_Item_Renderer_Grouped::GROUPED_PRODUCT_IMAGE) == Mage_Checkout_Block_Cart_Item_Renderer_Grouped::USE_PARENT_IMAGE)) {
|
221 |
+
$product = $this->getGroupedProduct($item);
|
222 |
+
}
|
223 |
+
return Mage::helper('catalog/image')->init($product, 'thumbnail');
|
224 |
+
}
|
225 |
+
// end grouped
|
226 |
+
|
227 |
+
|
228 |
+
return Mage::helper('catalog/image')->init($item->getProduct(), 'thumbnail');
|
229 |
+
|
230 |
+
}
|
231 |
+
|
232 |
+
|
233 |
+
|
234 |
+
|
235 |
+
/**
|
236 |
+
* Returns product options and additional attrubutes.
|
237 |
+
*
|
238 |
+
*/
|
239 |
+
|
240 |
+
function getProductOptions($item)
|
241 |
+
{
|
242 |
+
$options = array();
|
243 |
+
if ($optionIds = $item->getOptionByCode('option_ids')) {
|
244 |
+
$options = array();
|
245 |
+
foreach (explode(',', $optionIds->getValue()) as $optionId) {
|
246 |
+
if ($option = $item->getProduct()->getOptionById($optionId)) {
|
247 |
+
|
248 |
+
$quoteItemOption = $item->getOptionByCode('option_' . $option->getId());
|
249 |
+
|
250 |
+
$group = $option->groupFactory($option->getType())
|
251 |
+
->setOption($option)
|
252 |
+
->setQuoteItemOption($quoteItemOption);
|
253 |
+
|
254 |
+
$options[] = array(
|
255 |
+
'label' => $option->getTitle(),
|
256 |
+
'value' => $group->getFormattedOptionValue($quoteItemOption->getValue()),
|
257 |
+
'print_value' => $group->getPrintableOptionValue($quoteItemOption->getValue()),
|
258 |
+
'option_id' => $option->getId(),
|
259 |
+
'option_type' => $option->getType(),
|
260 |
+
'custom_view' => $group->isCustomizedView()
|
261 |
+
);
|
262 |
+
}
|
263 |
+
}
|
264 |
+
}
|
265 |
+
if ($addOptions = $item->getOptionByCode('additional_options')) {
|
266 |
+
$options = array_merge($options, unserialize($addOptions->getValue()));
|
267 |
+
}
|
268 |
+
|
269 |
+
|
270 |
+
if ($item->getProduct()->isConfigurable()) {
|
271 |
+
$options = array_merge($this->getProductAttributes($item), $options); // configurable products
|
272 |
+
}
|
273 |
+
|
274 |
+
|
275 |
+
if ($item->getProduct()->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
|
276 |
+
$options = array_merge($this->_getBundleOptions($item), $options); // bundle products
|
277 |
+
}
|
278 |
+
|
279 |
+
|
280 |
+
return $options;
|
281 |
+
}
|
282 |
+
|
283 |
+
|
284 |
+
/**
|
285 |
+
* Returns formatted string of item description and attributes.
|
286 |
+
*
|
287 |
+
*/
|
288 |
+
|
289 |
+
function buildItemDescription($item) {
|
290 |
+
|
291 |
+
$crlf = "\n";
|
292 |
+
$valueSeperator = " - ";
|
293 |
+
$output = "";
|
294 |
+
$output .= $this->htmlEscape($item->getName()).$crlf;
|
295 |
+
|
296 |
+
$options = $this->getProductOptions($item);
|
297 |
+
if (count($options)) {
|
298 |
+
for ($c=0; $c<count($options); $c++) {
|
299 |
+
|
300 |
+
if (is_array($options[$c]["value"])) {
|
301 |
+
$output .= " [ ". $options[$c]["label"].": ".strip_tags(implode($valueSeperator,$options[$c]["value"]))." ] ";
|
302 |
+
}
|
303 |
+
else {
|
304 |
+
$output .= " [ ".$options[$c]["label"].": ".strip_tags($options[$c]["value"])." ] ";
|
305 |
+
}
|
306 |
+
|
307 |
+
$output .= $crlf;
|
308 |
+
}
|
309 |
+
}
|
310 |
+
|
311 |
+
// addition of links for downloadable products
|
312 |
+
//
|
313 |
+
if ($links = $this->getLinks($item)) {
|
314 |
+
$output .= " [ " . strip_tags($this->getLinksTitle($item));
|
315 |
+
foreach ($links as $link) {
|
316 |
+
$output .= " ( " . strip_tags($link->getTitle()) . " ) ";
|
317 |
+
}
|
318 |
+
$output .= " ] ";
|
319 |
+
$output .= $crlf;
|
320 |
+
}
|
321 |
+
|
322 |
+
|
323 |
+
return $output;
|
324 |
+
}
|
325 |
+
|
326 |
+
/**
|
327 |
+
* Returns the Product URL.
|
328 |
+
*
|
329 |
+
*/
|
330 |
+
|
331 |
+
function getProductUrl($item){
|
332 |
+
|
333 |
+
if ($item->getRedirectUrl()) {
|
334 |
+
return $item->getRedirectUrl();
|
335 |
+
}
|
336 |
+
$product = $item->getProduct();
|
337 |
+
$option = $item->getOptionByCode('product_type');
|
338 |
+
if ($option) {
|
339 |
+
$product = $option->getProduct();
|
340 |
+
}
|
341 |
+
|
342 |
+
return $product->getUrlModel()->getUrl($product);
|
343 |
+
|
344 |
+
}
|
345 |
+
|
346 |
+
/**
|
347 |
+
* Returns the Product Brand name.
|
348 |
+
*
|
349 |
+
*/
|
350 |
+
|
351 |
+
function getBrand($item){
|
352 |
+
|
353 |
+
$product = $item->getProduct();
|
354 |
+
$brand = $product->getAttribute('manufacturer');
|
355 |
+
return $brand;
|
356 |
+
}
|
357 |
+
function getWeight($item){
|
358 |
+
|
359 |
+
$product = $item->getProduct();
|
360 |
+
$brand = $product->getAttribute('weight');
|
361 |
+
return $brand;
|
362 |
+
}
|
363 |
+
/**
|
364 |
+
* Returns the Product Color.
|
365 |
+
*
|
366 |
+
*/
|
367 |
+
|
368 |
+
function getColor($item){
|
369 |
+
|
370 |
+
$output = "";
|
371 |
+
$valueSeperator = " - ";
|
372 |
+
|
373 |
+
$options = $this->getProductOptions($item);
|
374 |
+
|
375 |
+
if (count($options)) {
|
376 |
+
if (is_array($options[1]["value"])){
|
377 |
+
if ($options[1]["label"]="Color"){
|
378 |
+
$output = strip_tags(implode($valueSeperator,$options[1]["value"]));
|
379 |
+
}
|
380 |
+
}else{
|
381 |
+
if ($options[1]["label"]="Color"){
|
382 |
+
$output = $options[1]["value"];
|
383 |
+
}
|
384 |
+
}
|
385 |
+
}
|
386 |
+
return $output;
|
387 |
+
}
|
388 |
+
|
389 |
+
/**
|
390 |
+
* Returns the Product Size.
|
391 |
+
*
|
392 |
+
*/
|
393 |
+
|
394 |
+
function getSize($item){
|
395 |
+
|
396 |
+
$output = "";
|
397 |
+
$valueSeperator = " - ";
|
398 |
+
|
399 |
+
$options = $this->getProductOptions($item);
|
400 |
+
|
401 |
+
if (count($options)) {
|
402 |
+
if (is_array($options[0]["value"])) {
|
403 |
+
if ($options[0]["label"]="Size"){
|
404 |
+
$output = strip_tags(implode($valueSeperator,$options[0]["value"]));
|
405 |
+
}
|
406 |
+
}else{
|
407 |
+
if ($options[0]["label"]="Size"){
|
408 |
+
$output = $options[0]["value"];
|
409 |
+
}
|
410 |
+
}
|
411 |
+
}
|
412 |
+
return $output;
|
413 |
+
}
|
414 |
+
|
415 |
+
|
416 |
+
|
417 |
+
/**
|
418 |
+
* Calculates and returns the domestic shipping price.
|
419 |
+
*
|
420 |
+
*/
|
421 |
+
|
422 |
+
function shippingPrice () {
|
423 |
+
|
424 |
+
$session = Mage::getSingleton('checkout/session');
|
425 |
+
$address = $session->getQuote()->getShippingAddress();
|
426 |
+
|
427 |
+
$bkCountryId = $address->getCountryId();
|
428 |
+
$bkCity = $address->getCity();
|
429 |
+
$bkPostcode = $address->getPostcode();
|
430 |
+
$bkRegionId = $address->getRegionId();
|
431 |
+
$bkRegion = $address->getRegion();
|
432 |
+
|
433 |
+
$address->setCountryId("US")
|
434 |
+
->setCity("California")
|
435 |
+
->setPostcode("91406")
|
436 |
+
->setRegionId("")
|
437 |
+
->setRegion("")
|
438 |
+
->setCollectShippingRates(true)->collectShippingRates();
|
439 |
+
|
440 |
+
|
441 |
+
|
442 |
+
$shippingCarrierMethodArr = explode("_",Mage::getStoreConfig('checkout/internationalcheckout/shipping_method'));
|
443 |
+
$shippingCarrier = $shippingCarrierMethodArr[0];
|
444 |
+
$shippingMethod = $shippingCarrierMethodArr[1];
|
445 |
+
$carriers[$shippingCarrier] = '';
|
446 |
+
$price = 0;
|
447 |
+
|
448 |
+
if ($shippingCarrier == "freedomesticshippingtogsx" && $shippingMethod == "freedomesticshippingtogsx") {
|
449 |
+
return $price;
|
450 |
+
}
|
451 |
+
|
452 |
+
$result = Mage::getModel('shipping/shipping')
|
453 |
+
->collectRatesByAddress($address, array_keys($carriers))
|
454 |
+
->getResult();
|
455 |
+
|
456 |
+
foreach ($result->getAllRates() as $rate) {
|
457 |
+
if ($rate instanceof Mage_Shipping_Model_Rate_Result_Error) {
|
458 |
+
$errors[$rate->getCarrierTitle()] = 1;
|
459 |
+
$price = -1; // error flag
|
460 |
+
} else {
|
461 |
+
|
462 |
+
if ($address->getFreeShipping()) {
|
463 |
+
$price = 0;
|
464 |
+
} else {
|
465 |
+
if ($shippingMethod == $rate->getMethod()) {
|
466 |
+
$price = $rate->getPrice();
|
467 |
+
}
|
468 |
+
}
|
469 |
+
|
470 |
+
if ($price) {
|
471 |
+
$price = Mage::helper('tax')->getShippingPrice($price, false, $address);
|
472 |
+
}
|
473 |
+
|
474 |
+
//unset($errors[$rate->getCarrierTitle()]);
|
475 |
+
|
476 |
+
}
|
477 |
+
}
|
478 |
+
|
479 |
+
|
480 |
+
$address->setCountryId($bkCountryId)
|
481 |
+
->setCity($bkCity)
|
482 |
+
->setPostcode($bkPostcode)
|
483 |
+
->setRegionId($bkRegionId)
|
484 |
+
->setRegion($bkRegion)
|
485 |
+
->setCollectShippingRates(true)->collectShippingRates();
|
486 |
+
|
487 |
+
|
488 |
+
return $price;
|
489 |
+
|
490 |
+
}
|
491 |
+
|
492 |
+
|
493 |
+
|
494 |
+
}
|
app/code/community/GSX/InternationalCheckout/Helper/Data.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class GSX_InternationalCheckout_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
}
|
app/code/community/GSX/InternationalCheckout/Model/International.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class GSX_InternationalCheckout_Model_International extends Varien_Object {
|
3 |
+
|
4 |
+
|
5 |
+
|
6 |
+
|
7 |
+
|
8 |
+
}
|
app/code/community/GSX/InternationalCheckout/Model/Servers.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class GSX_InternationalCheckout_Model_Servers {
|
3 |
+
/**
|
4 |
+
* Options getter
|
5 |
+
*
|
6 |
+
* @return array
|
7 |
+
*/
|
8 |
+
public function toOptionArray()
|
9 |
+
{
|
10 |
+
return array(
|
11 |
+
array('value' => 1, 'label'=>Mage::helper('adminhtml')->__('Sandbox')),
|
12 |
+
array('value' => 0, 'label'=>Mage::helper('adminhtml')->__('Live')),
|
13 |
+
);
|
14 |
+
}
|
15 |
+
}
|
app/code/community/GSX/InternationalCheckout/Model/Shippingmethods.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class GSX_InternationalCheckout_Model_Shippingmethods extends Mage_Adminhtml_Model_System_Config_Source_Shipping_Allmethods
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Return array of active carriers.
|
6 |
+
* @param bool $isActiveOnlyFlag
|
7 |
+
* @return array
|
8 |
+
*/
|
9 |
+
public function toOptionArray($isActiveOnlyFlag=true)
|
10 |
+
{
|
11 |
+
$carrierCode = 'freedomesticshippingtogsx';
|
12 |
+
$carrierTitle = 'Free domestic shipping to GSX';
|
13 |
+
|
14 |
+
$methods[$carrierCode] = array(
|
15 |
+
'label' => $carrierTitle,
|
16 |
+
'value' => array(),
|
17 |
+
);
|
18 |
+
|
19 |
+
$methodCode = 'freedomesticshippingtogsx';
|
20 |
+
$methodTitle = 'Free';
|
21 |
+
$methods[$carrierCode]['value'][] = array(
|
22 |
+
'value' => $carrierCode.'_'.$methodCode,
|
23 |
+
'label' => '['.$carrierCode.'] '.$methodTitle,
|
24 |
+
);
|
25 |
+
|
26 |
+
return array_merge(parent::toOptionArray(true), $methods);
|
27 |
+
}
|
28 |
+
|
29 |
+
}
|
app/code/community/GSX/InternationalCheckout/controllers/CheckoutController.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class GSX_InternationalCheckout_CheckoutController extends Mage_Core_Controller_Front_Action
|
3 |
+
{
|
4 |
+
public function indexAction()
|
5 |
+
{
|
6 |
+
$this->loadLayout();
|
7 |
+
$templateFile='InternationalCheckout/contentCheckout.phtml';
|
8 |
+
|
9 |
+
$block = $this->getLayout()->createBlock(
|
10 |
+
'internationalcheckout/international',
|
11 |
+
'internationalcheckout.international',
|
12 |
+
array('template' => $templateFile)
|
13 |
+
);
|
14 |
+
$this->getLayout()->getBlock('root')->setTemplate('page/1column.phtml');
|
15 |
+
$this->getLayout()->getBlock('content')->append($block);
|
16 |
+
$this->_initLayoutMessages('core/session');
|
17 |
+
$this->renderLayout();
|
18 |
+
|
19 |
+
}
|
20 |
+
}
|
21 |
+
?>
|
app/code/community/GSX/InternationalCheckout/controllers/InvoiceController.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class GSX_InternationalCheckout_InvoiceController extends Mage_Core_Controller_Front_Action
|
3 |
+
{
|
4 |
+
public function ProcessAction()
|
5 |
+
{
|
6 |
+
$this->loadLayout();
|
7 |
+
$templateFile='InternationalCheckout/contentInvoice.phtml';
|
8 |
+
|
9 |
+
$block = $this->getLayout()->createBlock(
|
10 |
+
'internationalcheckout/international',
|
11 |
+
'internationalcheckout.international',
|
12 |
+
array('template' => $templateFile)
|
13 |
+
);
|
14 |
+
$this->getLayout()->getBlock('root')->setTemplate('page/1column.phtml');
|
15 |
+
$this->getLayout()->getBlock('content')->append($block);
|
16 |
+
$this->_initLayoutMessages('core/session');
|
17 |
+
return $this->renderLayout();
|
18 |
+
}
|
19 |
+
|
20 |
+
public function indexAction()
|
21 |
+
{
|
22 |
+
$this->loadLayout();
|
23 |
+
$templateFile='InternationalCheckout/contentInvoice.phtml';
|
24 |
+
|
25 |
+
$block = $this->getLayout()->createBlock(
|
26 |
+
'internationalcheckout/international',
|
27 |
+
'internationalcheckout.international',
|
28 |
+
array('template' => $templateFile)
|
29 |
+
);
|
30 |
+
$this->getLayout()->getBlock('root')->setTemplate('page/1column.phtml');
|
31 |
+
$this->getLayout()->getBlock('content')->append($block);
|
32 |
+
$this->_initLayoutMessages('core/session');
|
33 |
+
return $this->renderLayout();
|
34 |
+
}
|
35 |
+
|
36 |
+
}
|
37 |
+
?>
|
app/code/community/GSX/InternationalCheckout/controllers/TrackingController.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class GSX_InternationalCheckout_TrackingController extends Mage_Core_Controller_Front_Action
|
3 |
+
{
|
4 |
+
public function indexAction()
|
5 |
+
{
|
6 |
+
$this->loadLayout();
|
7 |
+
$templateFile='InternationalCheckout/contentTracking.phtml';
|
8 |
+
|
9 |
+
$block = $this->getLayout()->createBlock(
|
10 |
+
'internationalcheckout/international',
|
11 |
+
'internationalcheckout.international',
|
12 |
+
array('template' => $templateFile)
|
13 |
+
);
|
14 |
+
$this->getLayout()->getBlock('root')->setTemplate('page/1column.phtml');
|
15 |
+
$this->getLayout()->getBlock('content')->append($block);
|
16 |
+
$this->_initLayoutMessages('core/session');
|
17 |
+
$this->renderLayout();
|
18 |
+
|
19 |
+
}
|
20 |
+
}
|
21 |
+
?>
|
app/code/community/GSX/InternationalCheckout/etc/config.xml
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<config>
|
2 |
+
<modules>
|
3 |
+
<GSX_InternationalCheckout>
|
4 |
+
<version>1.1.3</version>
|
5 |
+
</GSX_InternationalCheckout>
|
6 |
+
</modules>
|
7 |
+
|
8 |
+
<global>
|
9 |
+
<blocks>
|
10 |
+
<internationalcheckout>
|
11 |
+
<class>GSX_InternationalCheckout_Block</class>
|
12 |
+
</internationalcheckout>
|
13 |
+
</blocks>
|
14 |
+
<helpers>
|
15 |
+
<internationalcheckout>
|
16 |
+
<class>GSX_InternationalCheckout_Helper</class>
|
17 |
+
</internationalcheckout>
|
18 |
+
</helpers>
|
19 |
+
</global>
|
20 |
+
|
21 |
+
<frontend>
|
22 |
+
<routers>
|
23 |
+
<GSX_InternationalCheckout>
|
24 |
+
<use>standard</use>
|
25 |
+
<args>
|
26 |
+
<module>GSX_InternationalCheckout</module>
|
27 |
+
<frontName>GSXInternationalCheckout</frontName>
|
28 |
+
</args>
|
29 |
+
</GSX_InternationalCheckout>
|
30 |
+
</routers>
|
31 |
+
<layout>
|
32 |
+
<updates>
|
33 |
+
<internationalcheckout>
|
34 |
+
<file>internationalcheckout.xml</file>
|
35 |
+
</internationalcheckout>
|
36 |
+
</updates>
|
37 |
+
</layout>
|
38 |
+
</frontend>
|
39 |
+
|
40 |
+
<default>
|
41 |
+
<checkout>
|
42 |
+
<internationalcheckout>
|
43 |
+
<image_width>0</image_width>
|
44 |
+
<image_height>0</image_height>
|
45 |
+
<attrib_code>international_shipping</attrib_code>
|
46 |
+
</internationalcheckout>
|
47 |
+
</checkout>
|
48 |
+
</default>
|
49 |
+
|
50 |
+
</config>
|
app/code/community/GSX/InternationalCheckout/etc/system.xml
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<shipping>
|
5 |
+
<groups>
|
6 |
+
<internationalcheckout translate="label" module="checkout">
|
7 |
+
<label>GSX International Checkout</label>
|
8 |
+
<frontend_type>text</frontend_type>
|
9 |
+
<sort_order>13</sort_order>
|
10 |
+
<show_in_default>1</show_in_default>
|
11 |
+
<show_in_website>1</show_in_website>
|
12 |
+
<show_in_store>1</show_in_store>
|
13 |
+
<fields>
|
14 |
+
<name_of_company translate="label">
|
15 |
+
<label>Merchant ID</label>
|
16 |
+
<frontend_type>text</frontend_type>
|
17 |
+
<sort_order>1</sort_order>
|
18 |
+
<show_in_default>1</show_in_default>
|
19 |
+
<show_in_website>1</show_in_website>
|
20 |
+
<show_in_store>1</show_in_store>
|
21 |
+
<validate>required-entry</validate>
|
22 |
+
<comment>
|
23 |
+
<![CDATA[
|
24 |
+
<span>Please click the link below to obtain the Merchant ID required for successful integration.<br/><a href="http://globalshopex.com/join_us.html" target="_newtab">http://globalshopex.com/join_us.html</a></span>
|
25 |
+
]]>
|
26 |
+
</comment>
|
27 |
+
</name_of_company>
|
28 |
+
<image_width translate="label">
|
29 |
+
<label>Local Shipping</label>
|
30 |
+
<frontend_type>text</frontend_type>
|
31 |
+
<sort_order>2</sort_order>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>1</show_in_website>
|
34 |
+
<show_in_store>1</show_in_store>
|
35 |
+
<validate>validate-number</validate>
|
36 |
+
<comment>
|
37 |
+
<![CDATA[
|
38 |
+
<span>Example: 0</span>
|
39 |
+
]]>
|
40 |
+
</comment>
|
41 |
+
</image_width>
|
42 |
+
<image_height translate="label">
|
43 |
+
<label>Local Shipping EXP</label>
|
44 |
+
<frontend_type>text</frontend_type>
|
45 |
+
<sort_order>3</sort_order>
|
46 |
+
<show_in_default>1</show_in_default>
|
47 |
+
<show_in_website>1</show_in_website>
|
48 |
+
<show_in_store>1</show_in_store>
|
49 |
+
<validate>validate-number</validate>
|
50 |
+
<comment>
|
51 |
+
<![CDATA[
|
52 |
+
<span>Example: 0</span>
|
53 |
+
]]>
|
54 |
+
</comment>
|
55 |
+
</image_height>
|
56 |
+
<attrib_code translate="label">
|
57 |
+
<label>International Shipping Restriction Attribute Code</label>
|
58 |
+
<frontend_type>text</frontend_type>
|
59 |
+
<sort_order>4</sort_order>
|
60 |
+
<show_in_default>1</show_in_default>
|
61 |
+
<show_in_website>1</show_in_website>
|
62 |
+
<show_in_store>1</show_in_store>
|
63 |
+
<validate></validate>
|
64 |
+
<comment>
|
65 |
+
<![CDATA[
|
66 |
+
<span> * Value Required for Restricting International Shipping</span>
|
67 |
+
]]>
|
68 |
+
</comment>
|
69 |
+
</attrib_code>
|
70 |
+
<attrib_value translate="label">
|
71 |
+
<label>Iframe Active</label>
|
72 |
+
<frontend_type>text</frontend_type>
|
73 |
+
<sort_order>4</sort_order>
|
74 |
+
<show_in_default>1</show_in_default>
|
75 |
+
<show_in_website>1</show_in_website>
|
76 |
+
<show_in_store>1</show_in_store>
|
77 |
+
<comment>
|
78 |
+
<![CDATA[
|
79 |
+
<span> For show GlobalShopex Cart over iframe true</span>
|
80 |
+
]]>
|
81 |
+
</comment>
|
82 |
+
</attrib_value>
|
83 |
+
</fields>
|
84 |
+
</internationalcheckout>
|
85 |
+
</groups>
|
86 |
+
</shipping>
|
87 |
+
</sections>
|
88 |
+
</config>
|
app/design/frontend/base/default/layout/internationalcheckout.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.0.1">
|
3 |
+
<checkout_cart_index>
|
4 |
+
<reference name="content">
|
5 |
+
<reference name="checkout.cart">
|
6 |
+
<reference name="checkout.cart.methods">
|
7 |
+
<block type="internationalcheckout/international" name="internationalcheckout.international" template="internationalcheckout/international.phtml"/>
|
8 |
+
|
9 |
+
</reference>
|
10 |
+
</reference>
|
11 |
+
</reference>
|
12 |
+
</checkout_cart_index>
|
13 |
+
<customer_account_login translate="label">
|
14 |
+
<reference name="content">
|
15 |
+
<block type="customer/account_forgotpassword" name="forgotPassword" template="internationalcheckout/login.phtml" />
|
16 |
+
</reference>
|
17 |
+
</customer_account_login>
|
18 |
+
</layout>
|
app/design/frontend/base/default/template/internationalcheckout/Login.phtml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
<br>
|
3 |
+
<div class="account-login" >
|
4 |
+
<div class="col2-set">
|
5 |
+
<div class="col-1 new-users">
|
6 |
+
<div class="content" style="min-height: 45px">
|
7 |
+
<h2>International Checkout</h2>
|
8 |
+
<p>Tracking Globalshopex.com click</p>
|
9 |
+
</div>
|
10 |
+
<div class="buttons-set">
|
11 |
+
<form action="<?php echo Mage::getBaseUrl() ?>GSXInternationalCheckout/Tracking" method="post" id="GSXLogin-form">
|
12 |
+
<button type="submit" type="button" title="Tracking Globalshopex.com click here" class="button"><span><span>here</span></span></button>
|
13 |
+
</form>
|
14 |
+
</div>
|
15 |
+
</div>
|
16 |
+
</div>
|
17 |
+
</div>
|
app/design/frontend/base/default/template/internationalcheckout/contentCheckout.phtml
ADDED
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$merchant_id = trim(Mage::getStoreConfig('shipping/internationalcheckout/name_of_company'));
|
3 |
+
$GSX_Localshipping_EXP = trim(Mage::getStoreConfig('shipping/internationalcheckout/image_width'));
|
4 |
+
$GSX_Localshipping = trim(Mage::getStoreConfig('shipping/internationalcheckout/image_height'));
|
5 |
+
$GSX_shipping_restriction_attribute_code = trim(Mage::getStoreConfig('shipping/internationalcheckout/attrib_code'));
|
6 |
+
|
7 |
+
if($merchant_id != ""){
|
8 |
+
$gc_url = $this->GC_URL;
|
9 |
+
}else{
|
10 |
+
$gc_url = "http://globalshopex.com/join_us.html";
|
11 |
+
}
|
12 |
+
|
13 |
+
|
14 |
+
?>
|
15 |
+
|
16 |
+
<div class="col-main">
|
17 |
+
<div class="page-title">
|
18 |
+
<h1>International Checkout</h1>
|
19 |
+
</div>
|
20 |
+
<table id="shopping-cart-table" class="data-table cart-table" style="width: 710px">
|
21 |
+
<tr>
|
22 |
+
<td>
|
23 |
+
<iframe id="Gsframe" name="Gsframe" style="" frameborder="0" scrolling="auto" height="1600px" width="710px" allowtransparency="true" >
|
24 |
+
</iframe>
|
25 |
+
<form name="frmPP" id="frmPP" method="post" action="https://globalshopex.com/iframe/InternationalCheckout.aspx" target="Gsframe" >
|
26 |
+
<?php
|
27 |
+
$session = Mage::getSingleton('checkout/session');
|
28 |
+
$output = "";
|
29 |
+
$i = 1;
|
30 |
+
foreach ($session->getQuote()->getAllVisibleItems() as $item) {
|
31 |
+
$item_ID = $item->getProductId();
|
32 |
+
$_Product = Mage::getModel('catalog/product')->load($item_ID);
|
33 |
+
$ProductPrice=$item->getPrice();
|
34 |
+
$ProductPrice = substr ( $ProductPrice , 0,strrpos($ProductPrice, ".") +3 ) ;
|
35 |
+
$ProductWeight=$_Product->getWeight();
|
36 |
+
$ProductWeight = substr ( $ProductWeight , 0,strrpos($ProductWeight, ".") +3 ) ;
|
37 |
+
|
38 |
+
|
39 |
+
|
40 |
+
$output .= "<input type=\"hidden\" name=\"ProductDesc$i\" value=\"".$this->buildItemDescription($item)."\"/>\n";
|
41 |
+
$output .= "<input type=\"hidden\" name=\"ProductSKU$i\" value=\"".$_Product->getSku()."\"/>\n";
|
42 |
+
$output .= "<input type=\"hidden\" name=\"ProductLink$i\" value=\"".$this->getProductUrl($item)."\"/>\n";
|
43 |
+
$output .= "<input type=\"hidden\" name=\"ProductQty$i\" value=\"".$item->getQty()."\"/>\n";
|
44 |
+
$output .= "<input type=\"hidden\" name=\"ProductPrice$i\" value=\"".$ProductPrice ."\"/>\n";
|
45 |
+
$output .= "<input type=\"hidden\" name=\"ProductBrand$i\" value=\"".$this->getBrand($item)."\"/>\n";
|
46 |
+
$output .= "<input type=\"hidden\" name=\"ProductSize$i\" value=\"".$this->getSize($item)."\"/>\n";
|
47 |
+
$output .= "<input type=\"hidden\" name=\"ProductColor$i\" value=\"".$this->getColor($item)."\"/>\n";
|
48 |
+
$output .= "<input type=\"hidden\" name=\"ProductWeight$i\" value=\"".$ProductWeight."\"/>\n";
|
49 |
+
$output .= "<input type=\"hidden\" name=\"ProductCountry$i\" value=\"".$item->getCountry()."\"/>\n";
|
50 |
+
|
51 |
+
// International Shipping Restriction Check
|
52 |
+
|
53 |
+
$attributes = Mage::getResourceModel('eav/entity_attribute_collection')
|
54 |
+
->setEntityTypeFilter($_Product->getResource()->getTypeId())
|
55 |
+
->addFieldToFilter('attribute_code', $GSX_shipping_restriction_attribute_code)
|
56 |
+
->load(false);
|
57 |
+
$attribute = $attributes->getFirstItem()->setEntity($_Product->getResource());
|
58 |
+
$manufac = $attribute->getSource()->getAllOptions(false);
|
59 |
+
foreach ($manufac as $man) {
|
60 |
+
$intshiping[$man['value']] = $man['label'];
|
61 |
+
}
|
62 |
+
if($intshiping[$_Product->getData($GSX_shipping_restriction_attribute_code)] == 'No') $output .= "<input type=\"hidden\" name=\"Restricted$i\" value='0'/>\n";
|
63 |
+
else $output .= "<input type=\"hidden\" name=\"Restricted$i\" value='0'/>\n";
|
64 |
+
$imgWidth = "";
|
65 |
+
$imgHeight = "";
|
66 |
+
|
67 |
+
if ($imgWidth == "" || $imgWidth <=0) {
|
68 |
+
$imgWidth = 75;
|
69 |
+
}
|
70 |
+
$output .= "<input type=\"hidden\" name=\"ProductImage$i\" value=\"".$this->getProductThumbnail($item)->resize($imgWidth)."\"/>\n";
|
71 |
+
$i++;
|
72 |
+
}
|
73 |
+
|
74 |
+
echo $output;
|
75 |
+
|
76 |
+
if(isset($GSX_Localshipping_EXP)) $gsx_ls_exp = $GSX_Localshipping_EXP; else $gsx_ls_exp = "0";
|
77 |
+
if(isset($GSX_Localshipping)) $gsx_ls = $GSX_Localshipping; else $gsx_ls = "0";
|
78 |
+
|
79 |
+
$GSX_totals = $session->getQuote()->getData();
|
80 |
+
$coupon_code = $GSX_totals['coupon_code'];
|
81 |
+
$discount = $GSX_totals['subtotal'] - $GSX_totals['subtotal_with_discount'];
|
82 |
+
$perc = ($discount * 100) / $GSX_totals['subtotal'];
|
83 |
+
$perc = round($perc , 2);
|
84 |
+
?>
|
85 |
+
<!--
|
86 |
+
|
87 |
+
<input type="hidden" name="ODiscount" value="<?php echo $perc; ?>" />
|
88 |
+
<input type="hidden" name="ODiscCode" value="<?php echo $coupon_code; ?>" />
|
89 |
+
<input type="hidden" name="ODiscPerc" value="1" />
|
90 |
+
<input type="hidden" name="PrefilledCart" value="http://127.0.0.1/magento/index.php/GSXInternationalCheckout?gsxOption=Checkout">
|
91 |
+
|
92 |
+
-->
|
93 |
+
|
94 |
+
<input type="hidden" name="MerchantID" value="<?php echo $merchant_id; ?>" />
|
95 |
+
<input type="hidden" name="LocalShippingEXP" value="<?php echo $gsx_ls_exp; ?>" />
|
96 |
+
<input type="hidden" name="LocalShipping" value="<?php echo $gsx_ls; ?>" />
|
97 |
+
|
98 |
+
|
99 |
+
</form>
|
100 |
+
</td>
|
101 |
+
</tr>
|
102 |
+
</table>
|
103 |
+
</div>
|
104 |
+
<script language="javascript" type="text/javascript">
|
105 |
+
document.getElementById('frmPP').submit();
|
106 |
+
</script>
|
app/design/frontend/base/default/template/internationalcheckout/contentInvoice.phtml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
Mage::getSingleton('checkout/session')->clear();
|
3 |
+
?>
|
4 |
+
|
5 |
+
<div class="col-main">
|
6 |
+
<div class="page-title">
|
7 |
+
<h1>International Checkout</h1>
|
8 |
+
</div>
|
9 |
+
<table id="shopping-cart-table" class="data-table cart-table" style="width: 710px">
|
10 |
+
<tr>
|
11 |
+
<td>
|
12 |
+
<iframe id="Gsframe" name="Gsframe" frameborder="0" scrolling="auto" height="1600px" width="710px" allowtransparency="true" src="https://globalshopex.com/iframe/InternationalCheckout.aspx?Order=<?php echo $_GET['Order']?>">
|
13 |
+
</iframe>
|
14 |
+
</td>
|
15 |
+
</tr>
|
16 |
+
</table>
|
17 |
+
</div>
|
app/design/frontend/base/default/template/internationalcheckout/contentTracking.phtml
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$merchant_id = trim(Mage::getStoreConfig('shipping/internationalcheckout/name_of_company'));
|
3 |
+
?>
|
4 |
+
|
5 |
+
<div class="col-main">
|
6 |
+
<div class="page-title">
|
7 |
+
<h1>International Checkout</h1>
|
8 |
+
</div>
|
9 |
+
<table id="shopping-cart-table" class="data-table cart-table" style="width: 710px">
|
10 |
+
<tr>
|
11 |
+
<td>
|
12 |
+
|
13 |
+
<iframe id="Gsframe" name="Gsframe" frameborder="0" scrolling="auto" height="800px" width="100%" allowtransparency="true" onload="hideProgress()">GlobalShopex International checkout Order Tracking</iframe>
|
14 |
+
<form name="frmPP" id="frmPP" method="post" action="https://globalshopex.com/iframe/OrderTracking.aspx" target="Gsframe">
|
15 |
+
<div runat="server" id="itemInfo">
|
16 |
+
<input type="hidden" name="MerchantID" value="<?php echo $merchant_id; ?>" />
|
17 |
+
</form>
|
18 |
+
<script type="text/javascript">document.getElementById('frmPP').submit();</script>
|
19 |
+
</td>
|
20 |
+
</tr>
|
21 |
+
</table>
|
22 |
+
</div>
|
app/design/frontend/base/default/template/internationalcheckout/international.phtml
ADDED
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
|
3 |
+
|
4 |
+
<?php
|
5 |
+
|
6 |
+
$IsiframeActive = trim(Mage::getStoreConfig('shipping/internationalcheckout/attrib_value'));
|
7 |
+
|
8 |
+
|
9 |
+
$merchant_id = trim(Mage::getStoreConfig('shipping/internationalcheckout/name_of_company'));
|
10 |
+
$GSX_Localshipping_EXP = trim(Mage::getStoreConfig('shipping/internationalcheckout/image_width'));
|
11 |
+
$GSX_Localshipping = trim(Mage::getStoreConfig('shipping/internationalcheckout/image_height'));
|
12 |
+
$GSX_shipping_restriction_attribute_code = trim(Mage::getStoreConfig('shipping/internationalcheckout/attrib_code'));
|
13 |
+
|
14 |
+
if($merchant_id != ""){
|
15 |
+
$gc_url = $this->GC_URL;
|
16 |
+
}else{
|
17 |
+
$gc_url = "http://globalshopex.com/join_us.html";
|
18 |
+
}
|
19 |
+
if ($IsiframeActive=='true')
|
20 |
+
{
|
21 |
+
?>
|
22 |
+
|
23 |
+
<a href="<?php echo Mage::getBaseUrl() ?>GSXInternationalCheckout/Checkout" title="<?php echo $this->__('Global Checkout') ?>" >
|
24 |
+
<button title="<?php echo $this->__('Global Checkout') ?>" class="" <?php echo $this->buttonImagePath(); ?>></button>
|
25 |
+
</a>
|
26 |
+
|
27 |
+
<?php
|
28 |
+
}else{
|
29 |
+
?>
|
30 |
+
<form name="gcForm" id="gcForm" method="post" action="<?php echo $gc_url;?>">
|
31 |
+
|
32 |
+
<?php
|
33 |
+
|
34 |
+
$session = Mage::getSingleton('checkout/session');
|
35 |
+
$output = "";
|
36 |
+
$i = 1;
|
37 |
+
foreach ($session->getQuote()->getAllVisibleItems() as $item) {
|
38 |
+
$item_ID = $item->getProductId();
|
39 |
+
$_Product = Mage::getModel('catalog/product')->load($item_ID);
|
40 |
+
$ProductPrice=$item->getPrice();
|
41 |
+
$ProductPrice = substr ( $ProductPrice , 0,strrpos($ProductPrice, ".") +3 ) ;
|
42 |
+
$ProductWeight=$_Product->getWeight();
|
43 |
+
$ProductWeight = substr ( $ProductWeight , 0,strrpos($ProductWeight, ".") +3 ) ;
|
44 |
+
|
45 |
+
|
46 |
+
|
47 |
+
$output .= "<input type=\"hidden\" name=\"ProductDesc$i\" value=\"".$this->buildItemDescription($item)."\"/>\n";
|
48 |
+
$output .= "<input type=\"hidden\" name=\"ProductSKU$i\" value=\"".$_Product->getSku()."\"/>\n";
|
49 |
+
$output .= "<input type=\"hidden\" name=\"ProductLink$i\" value=\"".$this->getProductUrl($item)."\"/>\n";
|
50 |
+
$output .= "<input type=\"hidden\" name=\"ProductQty$i\" value=\"".$item->getQty()."\"/>\n";
|
51 |
+
$output .= "<input type=\"hidden\" name=\"ProductPrice$i\" value=\"".$ProductPrice ."\"/>\n";
|
52 |
+
$output .= "<input type=\"hidden\" name=\"ProductBrand$i\" value=\"".$this->getBrand($item)."\"/>\n";
|
53 |
+
$output .= "<input type=\"hidden\" name=\"ProductSize$i\" value=\"".$this->getSize($item)."\"/>\n";
|
54 |
+
$output .= "<input type=\"hidden\" name=\"ProductColor$i\" value=\"".$this->getColor($item)."\"/>\n";
|
55 |
+
$output .= "<input type=\"hidden\" name=\"ProductWeight$i\" value=\"".$ProductWeight."\"/>\n";
|
56 |
+
$output .= "<input type=\"hidden\" name=\"ProductCountry$i\" value=\"".$item->getCountry()."\"/>\n";
|
57 |
+
// International Shipping Restriction Check
|
58 |
+
|
59 |
+
$attributes = Mage::getResourceModel('eav/entity_attribute_collection')
|
60 |
+
->setEntityTypeFilter($_Product->getResource()->getTypeId())
|
61 |
+
->addFieldToFilter('attribute_code', $GSX_shipping_restriction_attribute_code)
|
62 |
+
->load(false);
|
63 |
+
$attribute = $attributes->getFirstItem()->setEntity($_Product->getResource());
|
64 |
+
$manufac = $attribute->getSource()->getAllOptions(false);
|
65 |
+
foreach ($manufac as $man) {
|
66 |
+
$intshiping[$man['value']] = $man['label'];
|
67 |
+
}
|
68 |
+
if($intshiping[$_Product->getData($GSX_shipping_restriction_attribute_code)] == 'No') $output .= "<input type=\"hidden\" name=\"Restricted$i\" value='0'/>\n";
|
69 |
+
else $output .= "<input type=\"hidden\" name=\"Restricted$i\" value='0'/>\n";
|
70 |
+
|
71 |
+
//
|
72 |
+
|
73 |
+
$imgWidth = "";
|
74 |
+
$imgHeight = "";
|
75 |
+
|
76 |
+
if ($imgWidth == "" || $imgWidth <=0) {
|
77 |
+
$imgWidth = 75;
|
78 |
+
}
|
79 |
+
if ($imgHeight == "" || $imgHeight <=0) {
|
80 |
+
$imgHeight = 75;
|
81 |
+
}
|
82 |
+
|
83 |
+
$output .= "<input type=\"hidden\" name=\"ProductImage$i\" value=\"".$this->getProductThumbnail($item)->resize($imgWidth)."\"/>\n";
|
84 |
+
$output .= "<input type=\"hidden\" name=\"ImgHeight$i\" value=\"".$imgHeight."\"/>\n";
|
85 |
+
$output .= "<input type=\"hidden\" name=\"ImgWidth$i\" value=\"".$imgWidth."\"/>\n";
|
86 |
+
|
87 |
+
$i++;
|
88 |
+
}
|
89 |
+
|
90 |
+
echo $output;
|
91 |
+
|
92 |
+
if(isset($GSX_Localshipping_EXP)) $gsx_ls_exp = $GSX_Localshipping_EXP; else $gsx_ls_exp = "0";
|
93 |
+
if(isset($GSX_Localshipping)) $gsx_ls = $GSX_Localshipping; else $gsx_ls = "0";
|
94 |
+
|
95 |
+
$GSX_totals = $session->getQuote()->getData();
|
96 |
+
$coupon_code = $GSX_totals['coupon_code'];
|
97 |
+
$discount = $GSX_totals['subtotal'] - $GSX_totals['subtotal_with_discount'];
|
98 |
+
$perc = ($discount * 100) / $GSX_totals['subtotal'];
|
99 |
+
$perc = round($perc , 2);
|
100 |
+
?>
|
101 |
+
|
102 |
+
<input type="hidden" name="ODiscount" value="<?php echo $perc; ?>" />
|
103 |
+
<input type="hidden" name="ODiscCode" value="<?php echo $coupon_code; ?>" />
|
104 |
+
<input type="hidden" name="ODiscPerc" value="1" />
|
105 |
+
<input type="hidden" name="MerchantID" value="<?php echo $merchant_id; ?>" />
|
106 |
+
<input type="hidden" name="LocalShippingEXP" value="<?php echo $gsx_ls_exp; ?>" />
|
107 |
+
<input type="hidden" name="LocalShipping" value="<?php echo $gsx_ls; ?>" />
|
108 |
+
<input type="hidden" name="PrefilledCart" value="<?php echo $this->helper('core/url')->getCurrentUrl();?>"/>
|
109 |
+
|
110 |
+
<button title="<?php echo $this->__('Global Checkout') ?>" class="" <?php echo $this->buttonImagePath(); ?> type="submit"></button>
|
111 |
+
</form>
|
112 |
+
|
113 |
+
<?php
|
114 |
+
}
|
115 |
+
?>
|
app/etc/modules/GSX_InternationalCheckout.xml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<GSX_InternationalCheckout>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</GSX_InternationalCheckout>
|
8 |
+
<depends>
|
9 |
+
<Mage_Checkout />
|
10 |
+
</depends>
|
11 |
+
</modules>
|
12 |
+
</config>
|
media/GSX/images/default/gc_button.gif
ADDED
Binary file
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>GSXInternationalCheckoutWithIframe</name>
|
4 |
+
<version>1.2.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>GPL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Installs International Checkout Button in your cart</summary>
|
10 |
+
<description>Installs International Checkout Button in your cart</description>
|
11 |
+
<notes>This is Stable version</notes>
|
12 |
+
<authors><author><name>GlobalShopex</name><user>GlobalShopex</user><email>alexis@GlobalShopex.com</email></author></authors>
|
13 |
+
<date>2013-08-22</date>
|
14 |
+
<time>16:41:54</time>
|
15 |
+
<contents><target name="mageetc"><dir name="modules"><file name="GSX_InternationalCheckout.xml" hash="87aba4b6648f7a0b22855cab679c48a1"/></dir></target><target name="magecommunity"><dir name="GSX"><dir name="InternationalCheckout"><dir name="Block"><file name="International.php" hash="c79b41303e600072021220e101608d2a"/></dir><dir name="Helper"><file name="Data.php" hash="d8a7158a95e55c8258d3f9ce50765417"/></dir><dir name="Model"><file name="International.php" hash="d14d71c1c7ca9b1cd0ead5d8dca339b6"/><file name="Servers.php" hash="2460f3985e80eddad55e08c6c15c947c"/><file name="Shippingmethods.php" hash="fa7dd994638cddb5c7c54abca859cbd3"/></dir><dir name="controllers"><file name="CheckoutController.php" hash="33cd5395068517f179849e2b1e0cbc3e"/><file name="InvoiceController.php" hash="5acafe701d267bda8035aa04a49571ec"/><file name="TrackingController.php" hash="772dd7f4390ce80b037bd5be15eb25cf"/></dir><dir name="etc"><file name="config.xml" hash="77e29a1271abea4c43370559a02b0110"/><file name="system.xml" hash="a4f68eefdb6aa7bfc59acddabfc4defe"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="internationalcheckout"><file name="Login.phtml" hash="971f4e9cb3e01bd5dc7206b4470c4159"/><file name="contentCheckout.phtml" hash="acf2742238bad0a408e4d2a6472ab9f7"/><file name="contentInvoice.phtml" hash="bc80d5e4fcf76068210bec4487c702a9"/><file name="contentTracking.phtml" hash="bcc63e5de842d1c1f621c1482cf3ebd9"/><file name="international.phtml" hash="27981ecb0d9b7509d1cbfee6f2405fad"/></dir></dir><dir name="layout"><file name="internationalcheckout.xml" hash="9cc53141430cb01172557996e4f43a69"/></dir></dir></dir></dir></target><target name="magemedia"><dir name="GSX"><dir name="images"><dir name="default"><file name="gc_button.gif" hash="4d53b9fb727fd399486e4c1d7b35170c"/></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>4.0.1</min><max>5.4.6</max></php></required></dependencies>
|
18 |
+
</package>
|