This file contains hidden or 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
| def before_delivery | |
| if @order.needs_delivery? | |
| return if params[:order].present? | |
| packages = @order.shipments.map(&:to_package) | |
| @differentiator = Spree::Stock::Differentiator.new(@order, packages) | |
| else | |
| #we select the shipping for the user | |
| @order.select_default_shipping | |
| @order.next #go to next step |
This file contains hidden or 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
| config.currency = "INR" | |
| #After that we need to update products currency accordingly. |
This file contains hidden or 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
| def remove_image | |
| @user.image.clear #This is optional you can skip it | |
| @user.image.destroy #This line delete image from paperclip | |
| # Now you need to update image url because destroy is not remove url so you need to update image field | |
| @user.update_attributes(image: nil) | |
| end | |
| #Note: You can directaly update your image field but it doesn't delete image from storage. | |
| #Note1: Controller name may be changed according to your requirement. |
This file contains hidden or 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
| $.ajaxSetup({ | |
| headers: { | |
| 'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content') | |
| } | |
| }); |
This file contains hidden or 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
| var mashkar = { | |
| init: function() { | |
| this.calculateTotalPrice(); | |
| }, | |
| calculateTotalPrice: function() { | |
| $(document).on("change", '.price-field', function() { | |
| var variantRow = $(this).closest(".variant-row"); | |
| var sellerPrice = parseFloat($(this).val()); |
This file contains hidden or 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
| #Add noty gem | |
| gem 'noty-rails' | |
| # Run bundle command from your terminal |
This file contains hidden or 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
| noty({text: "Please select an image", type: "error"}); | |
| #type may be warning, notice etc. |
This file contains hidden or 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
| def comment | |
| @comment = Spree::Post.new(post_params) | |
| @comment.attributes = {user_id: current_spree_user.id} | |
| if @comment.save | |
| render json: { | |
| success: true, | |
| comment: render_to_string((@comment.parent_id.blank? ? 'spree/shared/_previous_comments' : 'spree/shared/_comment_line_item'), :layout => false, :locals => { :comment => @comment }) | |
| } | |
| else | |
| render json: { |
This file contains hidden or 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
| Run the below comman in terminal | |
| xdg-open . | |
| A file explorer is opened | |
| then run index.html |
This file contains hidden or 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
| gem 'puma' |
OlderNewer