This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test 1234 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
123 | |
123 | |
123 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
angular.module('$XipsyPrismic', []) | |
// Everything Prismic Related | |
.factory('$XipsyPrismicFactory', function($window, $q){ | |
// Initial Prismic Setup | |
var Prismic = $window.Prismic | |
var config = {} | |
config.url = 'https://xipsy.prismic.io/api' | |
// Maybe we need that stuff later (?) | |
config.accessToken = 'MC5XQ1MtSkNZQUFDWUFMdFV3.77-9AO-_ve-_ve-_ve-_vWLvv71077-9GO-_vXLvv70977-977-9aSnvv73vv73vv70NU--_vV91ee-_vRs-77-9' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
function replaceText(selector, text, newText, flags) { | |
var matcher = new RegExp(text, flags); | |
$(selector).each(function () { | |
var $this = $(this); | |
if (!$this.children().length) | |
$this.text($this.text().replace(matcher, newText)); | |
}); | |
} | |
function replaceAllText() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PAID_ITEM_COUNT = 2 | |
DISCOUNTED_ITEM_COUNT = 1 | |
# Returns the integer amount of items that must be discounted next | |
# given the amount of items seen | |
# | |
def discounted_items_to_find(total_items_seen, discounted_items_seen) | |
Integer(total_items_seen / (PAID_ITEM_COUNT + DISCOUNTED_ITEM_COUNT) * DISCOUNTED_ITEM_COUNT) - discounted_items_seen | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PAID_ITEM_COUNT = 1 | |
DISCOUNTED_ITEM_COUNT = 1 | |
# Returns the integer amount of items that must be discounted next | |
# given the amount of items seen | |
# | |
def discounted_items_to_find(total_items_seen, discounted_items_seen) | |
Integer(total_items_seen / (PAID_ITEM_COUNT + DISCOUNTED_ITEM_COUNT) * DISCOUNTED_ITEM_COUNT) - discounted_items_seen | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PAID_ITEM_COUNT = 1 | |
DISCOUNTED_ITEM_COUNT = 1 | |
# Returns the integer amount of items that must be discounted next | |
# given the amount of items seen | |
# | |
def discounted_items_to_find(total_items_seen, discounted_items_seen) | |
Integer(total_items_seen / (PAID_ITEM_COUNT + DISCOUNTED_ITEM_COUNT) * DISCOUNTED_ITEM_COUNT) - discounted_items_seen | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DISCOUNTS_BY_QUANTITY = { | |
10_000 => 20, | |
1_000 => 15, | |
100 => 10, | |
10 => 5, | |
} | |
Input.cart.line_items.each do |line_item| | |
next if line_item.variant.product.gift_card? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DISCOUNTS_BY_QUANTITY = { | |
10_000 => 20, | |
1_000 => 15, | |
100 => 10, | |
10 => 5, | |
} | |
Input.cart.line_items.each do |line_item| | |
next if line_item.variant.product.gift_card? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@percent = Decimal.new(25) / 100.0 | |
Input.cart.line_items.each do |line_item| | |
product = line_item.variant.product | |
next if product.gift_card? | |
next unless product.tags.include?('myTag') | |
line_discount = line_item.line_price * @percent | |
line_item.change_line_price(line_item.line_price - line_discount, message: "25% Off") | |
end | |
Output.cart = Input.cart |
OlderNewer