Skip to content

Instantly share code, notes, and snippets.

--- /dev/null
+++ ../Model/Quote/Discount.php
@@ -178,10 +178,10 @@
$this->calculator->initTotals($items, $address);
$items = $this->calculator->sortItemsByPriority($items, $address);
$rules = $this->calculator->getRules($address);
- /** @var Rule $rule */
- foreach ($rules as $rule) {
- /** @var Item $item */
- foreach ($items as $item) {
@david-v
david-v / gist:39f1fc3a08309ebe704f
Last active August 29, 2015 14:14
Quick generic cURL request
<?php
function makeCURLRequest($method, $baseURL, $url, array $headers = null, string $body = null)
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($curl, CURLOPT_URL, $baseURL . $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HEADER, 1);
@david-v
david-v / MetadataBuilder
Created May 30, 2014 09:57
Service that generates metadata out of the paginated items returned by the KnpPaginator Symfony Bundle
class MetadataBuilder
{
protected $router;
public function __construct($router)
{
$this->router = $router;
}
/*
@david-v
david-v / gist:6824795
Created October 4, 2013 11:56
Select all inputs with name _method and value DELETE (generated automatically from Symfony 2.3) and add confirmation pop-up.
<script>
$( "input[name='_method'][value='DELETE']" ).parent().submit(function( event ) {
return confirm('Content will be permanently DELETED. Do you wish to continue?');
});
</script>