Sha256: 68640f454618da9f5764967822eb3ce74ebfa32341a228d43a58df02bf506b26

Contents?: true

Size: 1.58 KB

Versions: 16

Compression:

Stored size: 1.58 KB

Contents

# MageRecord RubyGem

## Introduction
Simple ActiveRecord wrapper for various Magento models.

## Installation

Add this line to your application's Gemfile:
```
gem 'magerecord'
```
And then execute:
```
$ bundle
```
Or install it yourself as:
```
$ gem install magerecord
```

## Basic Usage:
```
# require 'activerecord-jdbc-adapter' # if running jruby

# IMPORTANT: initialise magento mysql database connection
MageRecord::Connection.new 'localhost', 'db_name', 'username', 'password'


# get total number of orders
MageRecord::Order.count

# get latest order
order = MageRecord::Order.last

# get order items
order.items

# get associated products
order.products

# get customer's full name
order.customer.firstname + ' ' + order.customer.lastname

# get billing address
order.billing_address

# get shipping address
order.shipping_address


# get EAV attributes for the following Magento models:
# - MageRecord::Address
# - MageRecord::Customer
# - MageRecord::Product
MageRecord::Address.eav_attributes
MageRecord::Customer.eav_attributes
MageRecord::Product.eav_attributes


# get a product
product = MageRecord::Product.last

# get product name
product.name

# get custom product EAV attribute
# (note: these should first be defined in Magento)
product.flavor
product.size
product.color

# get product stock level
product.qty
```

## Contributing

1. Fork it ( http://github.com/mystix/magerecord/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
magerecord-0.5.8 README.md
magerecord-0.5.7 README.md
magerecord-0.5.6 README.md
magerecord-0.5.5 README.md
magerecord-0.5.4 README.md
magerecord-0.5.3 README.md
magerecord-0.5.2 README.md
magerecord-0.5.1 README.md
magerecord-0.5.0 README.md
magerecord-0.4.0 README.md
magerecord-0.3.1 README.md
magerecord-0.3.0 README.md
magerecord-0.2.2 README.md
magerecord-0.2.1 README.md
magerecord-0.2.0 README.md
magerecord-0.1.12 README.md