Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
joshine
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
joshine
Commits
738dc209
Commit
738dc209
authored
Mar 17, 2023
by
lmf
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'developer' into production
parents
99490722
27d9a21c
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
283 additions
and
82 deletions
+283
-82
app/code/Joshine/Banner/view/frontend/templates/index.phtml
+7
-6
app/code/Joshine/Sales/Plugin/DefaultRendererPlugin.php
+43
-40
app/code/Joshine/Sales/view/adminhtml/layout/sales_order_view.xml
+7
-0
app/code/Joshine/Sales/view/adminhtml/templates/order/totals.phtml
+69
-0
app/code/Magento/Checkout/Block/Cart/Shipping.php
+6
-0
app/code/Magento/Checkout/view/frontend/templates/cart/shipping.phtml
+18
-29
app/code/Magento/Checkout/view/frontend/web/js/model/quote.js
+10
-0
app/code/Magento/Checkout/view/frontend/web/js/model/shipping-rate-processor/get-address.js
+65
-0
app/code/Magento/Checkout/view/frontend/web/js/view/address-get.js
+25
-0
app/code/Magento/Checkout/view/frontend/web/js/view/summary/shipping.js
+25
-3
app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/shipping.js
+1
-1
app/design/frontend/Joshine/breeze/Magento_Checkout/layout/checkout_cart_index.xml
+3
-3
app/design/frontend/Joshine/breeze/Magento_Checkout/layout/checkout_index_index.xml
+4
-0
No files found.
app/code/Joshine/Banner/view/frontend/templates/index.phtml
View file @
738dc209
...
...
@@ -53,12 +53,13 @@ require(['jquery','banner'],function ($){
h_max
=
h
>
h_max
?
h
:
h_max
;
});
$
(
'.banner1'
).
height
(
h_max
);
$
(
'.banner1'
).
css
(
'line-height'
,
h_max
+
'px'
);
var
buttonTop
=
h_max
/
2
;
$
(
'#left'
).
css
({
'top'
:
buttonTop
,
'line-height'
:
0
});
$
(
'#right'
).
css
({
'top'
:
buttonTop
,
'line-height'
:
0
});
if
(
h_max
>
0
){
$
(
'.banner1'
).
height
(
h_max
);
$
(
'.banner1'
).
css
(
'line-height'
,
h_max
+
'px'
);
var
buttonTop
=
h_max
/
2
;
$
(
'#left'
).
css
({
'top'
:
buttonTop
,
'line-height'
:
0
});
$
(
'#right'
).
css
({
'top'
:
buttonTop
,
'line-height'
:
0
});
}
if
(
img_arr
.
length
<=
1
){
$
(
'.banner1 .list'
).
hide
();
$
(
'#left'
).
hide
();
...
...
app/code/Joshine/Sales/Plugin/DefaultRendererPlugin.php
View file @
738dc209
<?php
namespace
Joshine\Sales\Plugin
;
use
\Magento\Catalog\Helper\Image
as
ImageHelper
;
class
DefaultRendererPlugin
{
/**
* @var \Magento\Catalog\Helper\Image $imageHelper
*/
protected
$imageHelper
;
/**
* @param ImageHelper $imageHelper
*/
public
function
__construct
(
ImageHelper
$imageHelper
)
{
$this
->
imageHelper
=
$imageHelper
;
}
public
function
aroundGetColumnHtml
(
\Magento\Sales\Block\Adminhtml\Order\View\Items\Renderer\DefaultRenderer
$defaultRenderer
,
\Closure
$proceed
,
\Magento\Framework\DataObject
$item
,
$column
,
$field
=
null
)
{
if
(
$column
===
'image'
)
{
$img
=
$this
->
imageHelper
->
init
(
$item
->
getProduct
(),
'cart_page_product_thumbnail'
)
->
setImageFile
(
$item
->
getProduct
()
->
getImage
())
->
resize
(
100
)
->
getUrl
();
$result
=
'<img src="'
.
$img
.
'" alt="'
.
$item
->
getName
()
.
'" />'
;
}
else
{
if
(
$field
)
{
$result
=
$proceed
(
$item
,
$column
,
$field
);
}
else
{
$result
=
$proceed
(
$item
,
$column
);
}
}
return
$result
;
}
<?php
namespace
Joshine\Sales\Plugin
;
use
\Magento\Catalog\Helper\Image
as
ImageHelper
;
class
DefaultRendererPlugin
{
/**
* @var \Magento\Catalog\Helper\Image $imageHelper
*/
protected
$imageHelper
;
/**
* @param ImageHelper $imageHelper
*/
public
function
__construct
(
ImageHelper
$imageHelper
)
{
$this
->
imageHelper
=
$imageHelper
;
}
public
function
aroundGetColumnHtml
(
\Magento\Sales\Block\Adminhtml\Order\View\Items\Renderer\DefaultRenderer
$defaultRenderer
,
\Closure
$proceed
,
\Magento\Framework\DataObject
$item
,
$column
,
$field
=
null
)
{
$result
=
''
;
if
(
$column
===
'image'
)
{
if
(
$item
->
getProduct
())
{
$img
=
$this
->
imageHelper
->
init
(
$item
->
getProduct
(),
'cart_page_product_thumbnail'
)
->
setImageFile
(
$item
->
getProduct
()
->
getImage
())
->
resize
(
100
)
->
getUrl
();
$result
=
'<img src="'
.
$img
.
'" alt="'
.
$item
->
getName
()
.
'" />'
;
}
}
else
{
if
(
$field
)
{
$result
=
$proceed
(
$item
,
$column
,
$field
);
}
else
{
$result
=
$proceed
(
$item
,
$column
);
}
}
return
$result
;
}
}
\ No newline at end of file
app/code/Joshine/Sales/view/adminhtml/layout/sales_order_view.xml
View file @
738dc209
...
...
@@ -35,5 +35,11 @@
</arguments>
</referenceBlock>
</referenceBlock>
<referenceBlock
name=
'order_totals'
>
<action
method=
'setTemplate'
>
<argument
name=
'template'
xsi:type=
'string'
>
Joshine_Sales::order/totals.phtml
</argument>
</action>
</referenceBlock>
</body>
</page>
\ No newline at end of file
app/code/Joshine/Sales/view/adminhtml/templates/order/totals.phtml
0 → 100644
View file @
738dc209
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/* @var \Magento\Sales\Block\Adminhtml\Order\Totals $block */
?>
<table
class=
"data-table admin__table-secondary order-subtotal-table"
>
<?php
$_totals
=
$block
->
getTotals
(
'footer'
)
?>
<?php
if
(
$_totals
)
:
?>
<tfoot>
<?php
foreach
(
$block
->
getTotals
(
'footer'
)
as
$_code
=>
$_total
)
:
?>
<?php
if
(
$_total
->
getBlockName
())
:
?>
<?=
$block
->
getChildHtml
(
$_total
->
getBlockName
(),
false
)
?>
<?php
else
:
?>
<tr
class=
"col-
<?=
$block
->
escapeHtmlAttr
(
$_code
)
?>
"
>
<td
<?=
/* @noEscape */
$block
->
getLabelProperties
()
?>
class=
"label"
>
<strong>
<?=
$block
->
escapeHtml
(
$_total
->
getLabel
())
?>
</strong>
</td>
<td
<?=
/* @noEscape */
$block
->
getValueProperties
()
?>
>
<strong>
<?=
/* @noEscape */
$block
->
formatValue
(
$_total
)
?>
</strong>
</td>
</tr>
<?php
endif
;
?>
<?php
endforeach
;
?>
</tfoot>
<?php
endif
;
?>
<?php
$_totals
=
$block
->
getTotals
(
''
)
?>
<?php
if
(
$_totals
)
:
?>
<tbody>
<?php
foreach
(
$_totals
as
$_code
=>
$_total
)
:
?>
<?php
if
(
$_total
->
getBlockName
())
:
?>
<?=
$block
->
getChildHtml
(
$_total
->
getBlockName
(),
false
)
?>
<?php
else
:
?>
<?php
$totalsArr
[]
=
$_total
->
toArray
()
?>
<tr
class=
"col-
<?=
$block
->
escapeHtmlAttr
(
$_code
)
?>
"
>
<td
<?=
/* @noEscape */
$block
->
getLabelProperties
()
?>
class=
"label"
>
<?php
if
(
$_total
->
getStrong
())
:
?>
<strong>
<?=
$block
->
escapeHtml
(
$_total
->
getLabel
())
?>
</strong>
<?php
else
:
?>
<?=
$block
->
escapeHtml
(
$_total
->
getLabel
())
?>
<?php
endif
?>
</td>
<?php
if
(
$_total
->
getStrong
())
:
?>
<td
<?=
/* @noEscape */
$block
->
getValueProperties
()
?>
>
<strong>
<?=
/* @noEscape */
$block
->
formatValue
(
$_total
)
?>
</strong>
</td>
<?php
else
:
?>
<td
<?=
/* @noEscape */
$block
->
getValueProperties
()
?>
>
<span>
<?=
/* @noEscape */
$block
->
formatValue
(
$_total
)
?>
</span>
</td>
<?php
endif
;
?>
</tr>
<?php
endif
;
?>
<?php
endforeach
;
?>
<?php
$totalsArr
=
array_column
(
$totalsArr
,
null
,
'code'
);
?>
<tr
class=
"col-
<?php
echo
count
(
$totalsArr
);
?>
"
>
<td
class=
"label"
>
Row Tatol
</td>
<td><span><span
class=
"price"
>
$
<?php
if
(
isset
(
$totalsArr
[
'discount'
])){
echo
sprintf
(
"%01.2f"
,
round
(
floatval
(
$totalsArr
[
'subtotal'
][
'value'
])
+
floatval
(
$totalsArr
[
'discount'
][
'value'
]),
2
));}
else
{
echo
sprintf
(
"%01.2f"
,
floatval
(
$totalsArr
[
'subtotal'
][
'value'
]));}
?>
</span></span>
</td>
</tr>
</tbody>
<?php
endif
;
?>
</table>
app/code/Magento/Checkout/Block/Cart/Shipping.php
View file @
738dc209
...
...
@@ -119,4 +119,10 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart
{
return
$this
->
jsonHexTagSerializer
->
serialize
(
$this
->
getCheckoutConfig
());
}
public
function
getCountryHtmlSelect
(
$defValue
=
null
,
$name
=
'country_id'
,
$id
=
'country'
,
$title
=
'Country'
)
{
$objectManager
=
\Magento\Framework\App\ObjectManager
::
getInstance
();
/** @var \Magento\Directory\Block\Data $block */
$block
=
$objectManager
->
get
(
\Magento\Directory\Block\Data
::
class
);
return
$block
->
getCountryHtmlSelect
(
$defValue
,
$name
,
$id
,
$title
);
}
}
app/code/Magento/Checkout/view/frontend/templates/cart/shipping.phtml
View file @
738dc209
...
...
@@ -7,35 +7,24 @@
?>
<?php
/** @var $block \Magento\Checkout\Block\Cart\Shipping */
?>
<?php
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
?>
<div
id=
"block-shipping"
class=
"block shipping"
data-mage-init=
'{"collapsible":{"openedState": "active", "saveState": true}}'
>
<div
class=
"title"
data-role=
"title"
>
<strong
id=
"block-shipping-heading"
role=
"heading"
aria-level=
"2"
>
<?=
$block
->
getQuote
()
->
isVirtual
()
?
$block
->
escapeHtml
(
__
(
'Estimate Tax'
))
:
$block
->
escapeHtml
(
__
(
'Estimate Shipping and Tax'
))
?>
</strong>
</div>
<div
id=
"block-summary"
data-bind=
"scope:'block-summary'"
class=
"content"
data-role=
"content"
aria-labelledby=
"block-shipping-heading"
>
<!-- ko template: getTemplate() --><!-- /ko -->
<script
type=
"text/x-magento-init"
>
{
"#block-summary"
:
{
"Magento_Ui/js/core/app"
:
<?=
/* @noEscape */
$block
->
getJsLayout
()
?>
}
}
</script>
<?php
$serializedCheckoutConfig
=
/* @noEscape */
$block
->
getSerializedCheckoutConfig
();
$scriptString
=
<<<script
<div
id=
"block-shipping"
class=
"block shipping"
>
<div
id=
"block-summary"
style=
"display: none;"
>
<form
method=
"post"
id=
"shipping-zip-form"
>
<fieldset
class=
"fieldset estimate"
>
<div
class=
"field"
name=
"shippingAddress.country_id"
>
<label
class=
"label"
for=
"shipping_country_id"
>
<span>
<?=
__
(
'Country'
)
?>
</span>
</label>
<div
class=
"control"
>
<?=
$block
->
getCountryHtmlSelect
(
null
,
'country_id'
,
'shipping_country_id'
)
?>
</div>
</div>
</fieldset>
</form>
<?php
$serializedCheckoutConfig
=
/* @noEscape */
$block
->
getSerializedCheckoutConfig
();
$scriptString
=
<<<script
window.checkoutConfig = {$serializedCheckoutConfig};
window.customerData = window.checkoutConfig.customerData;
...
...
@@ -50,7 +39,7 @@ $scriptString = <<<script
return url.setBaseUrl('{$block->escapeJs($block->escapeUrl($block->getBaseUrl()))}');
})
script;
?>
?>
<?=
/* @noEscape */
$secureRenderer
->
renderTag
(
'script'
,
[],
$scriptString
,
false
)
?>
</div>
</div>
app/code/Magento/Checkout/view/frontend/web/js/model/quote.js
View file @
738dc209
...
...
@@ -29,6 +29,7 @@ define([
billingAddress
=
ko
.
observable
(
null
),
shippingAddress
=
ko
.
observable
(
null
),
shippingMethod
=
ko
.
observable
(
null
),
shippingSaveMethod
=
ko
.
observable
(
null
),
paymentMethod
=
ko
.
observable
(
null
),
paymentMethodlist
=
ko
.
observable
(
null
),
quoteData
=
window
.
checkoutConfig
.
quoteData
,
...
...
@@ -43,6 +44,7 @@ define([
totals
:
totals
,
shippingAddress
:
shippingAddress
,
shippingMethod
:
shippingMethod
,
shippingSaveMethod
:
shippingSaveMethod
,
billingAddress
:
billingAddress
,
paymentMethod
:
paymentMethod
,
paymentMethodlist
:
paymentMethodlist
,
...
...
@@ -113,12 +115,20 @@ define([
getPaymentMethod
:
function
()
{
return
paymentMethod
;
},
setShippingSaveMethod
:
function
(
Method
)
{
shippingSaveMethod
(
Method
);
},
getShippingSaveMethod
:
function
()
{
return
shippingSaveMethod
;
},
setPaymentMethodList
:
function
(
MethodList
)
{
paymentMethodlist
(
MethodList
);
},
getPaymentMethodList
:
function
()
{
return
paymentMethodlist
;
},
/**
* @return {*}
*/
...
...
app/code/Magento/Checkout/view/frontend/web/js/model/shipping-rate-processor/get-address.js
0 → 100644
View file @
738dc209
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define
([
'Magento_Checkout/js/model/resource-url-manager'
,
'Magento_Checkout/js/model/quote'
,
'mage/storage'
,
'Magento_Checkout/js/model/shipping-service'
,
'Magento_Checkout/js/model/error-processor'
,
'Magento_Checkout/js/action/select-shipping-address'
,
'Magento_Checkout/js/model/address-converter'
,
'Magento_Checkout/js/view/cart/shipping-estimation'
],
function
(
resourceUrlManager
,
quote
,
storage
,
shippingService
,
errorProcessor
,
selectShippingAddress
,
addressConverter
)
{
'use strict'
;
return
{
/**
* Get shipping rates for specified address.
* @param {Object} address
*/
getRates
:
function
(
address
)
{
var
cache
,
serviceUrl
,
payload
;
shippingService
.
isLoading
(
true
);
serviceUrl
=
resourceUrlManager
.
getUrlForEstimationShippingMethodsForNewAddress
(
quote
);
payload
=
JSON
.
stringify
({
address
:
{
'street'
:
address
.
street
,
'city'
:
address
.
city
,
'region_id'
:
address
.
regionId
,
'region'
:
address
.
region
,
'country_id'
:
address
.
countryId
,
'postcode'
:
address
.
postcode
,
'email'
:
address
.
email
,
'customer_id'
:
address
.
customerId
,
'firstname'
:
address
.
firstname
,
'lastname'
:
address
.
lastname
,
'middlename'
:
address
.
middlename
,
'prefix'
:
address
.
prefix
,
'suffix'
:
address
.
suffix
,
'vat_id'
:
address
.
vatId
,
'company'
:
address
.
company
,
'telephone'
:
address
.
telephone
,
'fax'
:
address
.
fax
,
'custom_attributes'
:
address
.
customAttributes
,
'save_in_address_book'
:
address
.
saveInAddressBook
}
}
);
storage
.
post
(
serviceUrl
,
payload
,
false
).
done
(
function
(
result
)
{
var
new_sh
=
[];
new_sh
.
push
(
result
[
0
]);
if
(
result
.
length
>
1
)
{
quote
.
setShippingSaveMethod
(
result
[
1
]);
}
selectShippingAddress
(
addressConverter
.
formAddressDataToQuoteAddress
(
address
));
//shippingService.setShippingRates(new_sh);
});
}
};
});
app/code/Magento/Checkout/view/frontend/web/js/view/address-get.js
0 → 100644
View file @
738dc209
define
([
'uiComponent'
,
'uiRegistry'
,
'underscore'
,
'Magento_Checkout/js/model/shipping-rate-processor/get-address'
],
function
(
Component
,
registry
,
_
,
getAddress
)
{
'use strict'
;
return
Component
.
extend
({
/** @inheritdoc */
initialize
:
function
()
{
this
.
_super
();
var
address
=
{};
address
.
countryId
=
window
.
checkoutConfig
.
defaultCountryId
;
getAddress
.
getRates
(
address
);
}
});
});
app/code/Magento/Checkout/view/frontend/web/js/view/summary/shipping.js
View file @
738dc209
...
...
@@ -29,6 +29,21 @@ define([
if
(
!
this
.
isCalculated
())
{
return
''
;
}
var
price
;
if
(
!
this
.
isCalculated
())
{
return
this
.
notCalculatedMessage
;
}
price
=
this
.
totals
()[
'shipping_amount'
];
if
(
price
==
0
)
{
if
(
quote
.
shippingSaveMethod
())
{
return
quote
.
shippingSaveMethod
()[
'method_title'
];
}
}
shippingMethod
=
quote
.
shippingMethod
();
if
(
!
_
.
isArray
(
shippingMethod
)
&&
!
_
.
isObject
(
shippingMethod
))
{
...
...
@@ -57,7 +72,7 @@ define([
/**
* @return {*}
getValue: function () {
getValue: function () {
var price;
if (!this.isCalculated()) {
...
...
@@ -78,7 +93,10 @@ define([
price
=
this
.
totals
()[
'shipping_amount'
];
if
(
price
==
0
)
{
return
this
.
getFormattedPrice
(
6.99
);
if
(
quote
.
shippingSaveMethod
())
{
return
this
.
getFormattedPrice
(
quote
.
shippingSaveMethod
()[
'amount'
]);
}
}
return
this
.
getFormattedPrice
(
price
);
},
...
...
@@ -91,7 +109,11 @@ define([
price
=
this
.
totals
()[
'shipping_amount'
];
if
(
price
==
0
)
{
return
'-'
+
this
.
getFormattedPrice
(
6.99
);
if
(
quote
.
shippingSaveMethod
())
{
return
'-'
+
this
.
getFormattedPrice
(
quote
.
shippingSaveMethod
()[
'amount'
]);
}
return
0
;
}
},
...
...
app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/shipping.js
View file @
738dc209
...
...
@@ -51,7 +51,7 @@ define([
},
isSaveShowed
:
function
()
{
var
price
=
this
.
totals
()[
'shipping_amount'
];
if
(
price
)
if
(
price
!=
0
)
{
return
false
;
}
...
...
app/design/frontend/Joshine/breeze/Magento_Checkout/layout/checkout_cart_index.xml
View file @
738dc209
...
...
@@ -37,7 +37,7 @@
<referenceContainer
name=
"content"
>
<block
class=
"Magento\Framework\View\Element\Template"
name=
"checkout.cart.footer"
template=
"Magento_Checkout::footer.phtml"
/>
</referenceContainer>
<!--
<referenceBlock
name=
"checkout.cart.totals"
>
<arguments>
<argument
name=
"jsLayout"
xsi:type=
"array"
>
...
...
@@ -45,7 +45,7 @@
<item
name=
"block-totals"
xsi:type=
"array"
>
<item
name=
"children"
xsi:type=
"array"
>
<item
name=
"shpping-get"
xsi:type=
"array"
>
<item name="component" xsi:type="string">Magento_Checkout/js/view/
shipping
-get</item>
<item
name=
"component"
xsi:type=
"string"
>
Magento_Checkout/js/view/
address
-get
</item>
</item>
</item>
</item>
...
...
@@ -53,6 +53,6 @@
</argument>
</arguments>
</referenceBlock>
-->
</body>
</page>
app/design/frontend/Joshine/breeze/Magento_Checkout/layout/checkout_index_index.xml
View file @
738dc209
...
...
@@ -67,6 +67,10 @@
<item
name=
"component"
xsi:type=
"string"
>
Magento_Checkout/js/view/security
</item>
<item
name=
"displayArea"
xsi:type=
"string"
>
security
</item>
</item>
<item
name=
"addressGet"
xsi:type=
"array"
>
<item
name=
"component"
xsi:type=
"string"
>
Magento_Checkout/js/view/address-get
</item>
<item
name=
"displayArea"
xsi:type=
"string"
>
addressGet
</item>
</item>
</item>
</item>
</item>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment