这是我在产品详情页面上显示的产品规格: -
方形影片细分
Total Heated Area: 4,322 sq. ft.
1st Floor: 2,586 sq. ft.
2nd Floor: 1,521 sq. ft.
Apartment: 215 sq. ft.
Lanai: 715 sq. ft.
Balcony/Veranda: 323 sq. ft.
Entry: 236 sq. ft.
床/浴场
Bedrooms: 4
Full Bathrooms: 4
Half Bathrooms: 2
尺寸
Width: 59' 8"
Depth: 104' 0"
车库
Type: Attached
Area: 859 sq. ft.
Details: 3 cars
Location: Rear
基础类型
Standard Foundations: Slab
所以现在我创建了3个实体: -
规格类别: -
/**
* SpecificationCategory
* @ORM\Table(name="specification_category")
* @ORM\Entity
*/
class SpecificationCategory
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255)
*/
private $name;
规范实体: -
/**
* Specification
* @ORM\Table(name="specification")
* @ORM\Entity
*/
class Specification
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var \XXX\Bundle\XXXBundle\Entity\SpecificationCategory
*
* @ORM\ManyToOne(targetEntity="XXX\Bundle\XXXBundle\Entity\SpecificationCategory")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="specification_category_id", referencedColumnName="id")
* })
*/
private $specificationCategory;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255)
*/
private $name;
/**
* @var string
*
* @ORM\Column(name="description", type="text", nullable=true)
*/
private $description;
/**
* @var string
*
* @ORM\Column(name="area", type="string", length=255, nullable=true)
*/
private $area;
/**
* @var integer
*
* @ORM\Column(name="price", type="integer", length=11, nullable=true)
*/
private $price;
产品: -
/**
* Product
* @ORM\Table()
*/
class Product
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\ManyToMany(targetEntity="XXX\Bundle\XXXBundle\Entity\Specification")
* @ORM\JoinTable(name="product_specification",
* joinColumns={@ORM\JoinColumn(name="product_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="specification_id", referencedColumnName="id")}
* )
**/
private $specification;
现在管理客户端需要首先创建规范类别,如: - " Square Footage Breakdown"然后创建规范名称,如: - "总加热面积"和他的价值一个接一个。
这是完美的。
问题是客户希望这些字段在管理员中是静态的...所以他只需在上传产品时输入值,而不是每次都添加单独的规格相同名称和不同的值。
任何帮助都将受到高度赞赏。 谢谢!