Skip to content

Instantly share code, notes, and snippets.

View serg2801's full-sized avatar

Sergey Koretskiy serg2801

View GitHub Profile
require 'open-uri'
def all_product
products = Product.all
products.each do |product|
id = product.id
image_path = product.image.path.split('/')
image_name = image_path[4]
save_img(image_name, id)
end
end
<% @prototype_properties.sort_by{ |prop| -prop[:id] }.each do |prop| %>
$("a.spree_add_fields").click();
$(".product_property.fields:first input[type=text]:first").val("<%= prop.name %>");
$input = $(".product_property.fields:first input[type=text]:eq(1)");
$parentBlock = $input.parent();
$objectClass = $input.attr('class');
$objectName = $input.attr('name');
$objectId = $input.attr('id');
console.log($objectClass);
console.log($(".product_property.fields:first input[type=text]:eq(1)").parent());
{"items":[{"item_number":"B104-66","description":"King Poster Footboard","depth_inches":"4.61","height_inches":"25.55","length_inches":"80.08","unit_price":"87.00","net_price":"90.05","status":"126"},{"item_number":"B104-99","description":"King Poster Rails","depth_inches":"84.02","height_inches":"18.07","length_inches":"78.78","unit_price":"54.00","net_price":"55.89","status":"90"},{"item_number":"B104-98","description":"Queen Poster Rails","depth_inches":"84.02","height_inches":"18.07","length_inches":"62.28","unit_price":"43.00","net_price":"44.51","status":"157"},{"item_number":"B104-96","description":"Queen Sleigh Rails","depth_inches":"76.93","height_inches":"11.18","length_inches":"62.28","unit_price":"32.00","net_price":"33.12","status":"59"},{"item_number":"B104-92","description":"Two Drawer Night Stand","depth_inches":"15.71","height_inches":"25.83","length_inches":"24.25","unit_price":"59.99","net_price":"62.09","status":"52"},{"item_number":"B104-77","description":"Queen Sleigh Headboard","depth_i
<itemCharacteristics>
<itemUnits unitOfMeasure="Each" value="1" />
<itemUnitDescription>King/Cal King UPH Headboard</itemUnitDescription>
<itemDimensions>
<depth unitOfMeasure="Inches" value="4" />
<height unitOfMeasure="Inches" value="69" />
<length unitOfMeasure="Inches" value="82" />
</itemDimensions>
</itemCharacteristics>
<itemCharacteristics>
<item itemType="9" itemClass="ZEBR" retailSalesCategory="DB" itemGroupCode="B130" itemStatus="Active" itemIsAvailable="true" itemIsPackage="false" harmonizationCode="9403896015" image="B130-481_BIG.jpg">
<itemIdentification>
<itemIdentifier itemNumber="B130-481" itemNumberQualifier="SellerAssigned" />
<itemIdentifier itemNumber="B130-481" itemNumberQualifier="BuyerAssigned" />
<itemIdentifier itemNumber="024052380750" itemNumberQualifier="UPC" />
<itemDescription descriptionValue="Queen Upholstered Bed" itemDescriptionQualifier="SellerAssigned" itemDescriptionClassification="Product" itemFriendlyDescription="Queen Upholstered Bed" />
<itemCharacteristics>
<itemUnits unitOfMeasure="Each" value="1" />
<itemUnitDescription>Queen Upholstered Bed</itemUnitDescription>
<itemDimensions>
<item itemType="9" itemClass="ZVTB" retailSalesCategory="DA" itemGroupCode="A1000556" itemStatus="Active" itemIsAvailable="true" itemIsPackage="false" harmonizationCode="9404902000" image="A1000556_BIG.jpg">
<itemIdentification>
<itemIdentifier itemNumber="A1000556" itemNumberQualifier="SellerAssigned" />
<itemIdentifier itemNumber="A1000556" itemNumberQualifier="BuyerAssigned" />
<itemIdentifier itemNumber="024052384802" itemNumberQualifier="UPC" />
<itemDescription descriptionValue="Pillow (4/CS)/Glendive/Red" itemDescriptionQualifier="SellerAssigned" itemDescriptionClassification="Product" itemFriendlyDescription="Pillow (4/CS)" />
<itemCharacteristics>
<itemUnits unitOfMeasure="Each" value="1" />
<itemUnitDescription>Pillow (4/CS)/Glendive/Red</itemUnitDescription>
</itemCharacteristics>
{ "customer":
{
"first_name":"Joe",
"last_name":"Doe",
"email":"[email protected]",
"phone":"999-999-9999",
"addresses_attributes":[{
"address1":"123 somewhere st",
"customer_id":"",
"address2":"",
{
"item_group_code":"B105",
"color":"Reddish Brown",
"items":[
{
"item_number":"B105-99",
"description":"King Poster Rails",
"dimensions_inches_format":"39\"W x 84.02\"D x 18.07\"H",
"unit_price":"54.00",
"net_price":"55.89",
<item itemType="1" itemClass="ZDBC" retailSalesCategory="DB" itemGroupCode="B104" itemStatus="Active" itemIsAvailable="true" itemIsPackage="false" harmonizationCode="7009925000" image="B104-31-36-46-57-92-SD_BIG.jpg">
<itemIdentification>
<itemIdentifier itemNumber="B104-36" itemNumberQualifier="SellerAssigned" />
<itemIdentifier itemNumber="B104-36" itemNumberQualifier="BuyerAssigned" />
<itemIdentifier itemNumber="024052043358" itemNumberQualifier="UPC" />
<itemDescription descriptionValue="Bedroom Mirror/Constellations" itemDescriptionQualifier="SellerAssigned" itemDescriptionClassification="Product" itemFriendlyDescription="Bedroom Mirror" itemFeatures="Deep glossy replicated black paint." />
<itemCharacteristics>
<itemUnits unitOfMeasure="Each" value="1" />
<itemUnitDescription>Bedroom Mirror/Constellations</itemUnitDescription>
<itemDimensions>
<itemAdvice lineItemNumber="5130">
<itemId>
<itemIdentifier itemNumber="B216-31" itemNumberQualifier="SellerAssigned" />
</itemId>
<itemAvailability availability="current">
<availQty unitOfMeasure="Each" value="32" />
<availDate>2017-06-13</availDate>
</itemAvailability>
<itemAvailability availability="future">
<availQty unitOfMeasure="Each" value="32" />