在本文中,我们将详细介绍php–Magento将自定义字段添加到客户帐户教程问题的各个方面,并为您提供关于phpmyadmin添加字段的相关解答,同时,我们也将为您带来关于c#–Sitecore–将自
在本文中,我们将详细介绍php – Magento将自定义字段添加到客户帐户教程问题的各个方面,并为您提供关于phpmyadmin添加字段的相关解答,同时,我们也将为您带来关于c# – Sitecore – 将自定义字段添加到用户编辑器、Django模型:向自定义字段添加验证、ios – 如何将自定义HTTP标头字段添加到HLS的AVPlayer请求、javascript – 将自定义搜索字段添加到数据表对象的有用知识。
本文目录一览:- php – Magento将自定义字段添加到客户帐户教程问题(phpmyadmin添加字段)
- c# – Sitecore – 将自定义字段添加到用户编辑器
- Django模型:向自定义字段添加验证
- ios – 如何将自定义HTTP标头字段添加到HLS的AVPlayer请求
- javascript – 将自定义搜索字段添加到数据表对象
php – Magento将自定义字段添加到客户帐户教程问题(phpmyadmin添加字段)
我已经完全按照第7步完成了第7步.我实际上将所有文件(可以下载的设计目录中的文件除外)放到我的app目录中.巧合的是,我也试图添加“学校”属性,所以到目前为止我还没有改变一件事.我在eav_attribute表中看到“school”.该模块在系统>配置>高级>模块输出中列为已启用.我已经重新编制索引并刷新缓存,登录和注销.当我尝试编辑客户时,我仍然看不到“学校”属性.我使用vs 1.7.是否应在客户的“帐户信息”标签中找到此字段?这个教程有什么过时的吗?
这都是代码下载,但供参考(他错过了PHP标签的关闭,所以我也添加了这些):
控制器/ IndexController.PHP
<?PHP
class Excellence_Profile_IndexController extends Mage_Core_Controller_Front_Action
{
public function indexAction()
{
$this->loadLayout();
$this->renderLayout();
}
}
?>
等/ config.xml中
<?xml version="1.0"?>
<config>
<modules>
<Excellence_Profile>
<version>0.1.0</version>
</Excellence_Profile>
</modules>
<frontend>
<routers>
<profile>
<use>standard</use>
<args>
<module>Excellence_Profile</module>
<frontName>profile</frontName>
</args>
</profile>
</routers>
<layout>
<updates>
<profile>
<file>profile.xml</file>
</profile>
</updates>
</layout>
</frontend>
<admin>
<routers>
<profile>
<use>admin</use>
<args>
<module>Excellence_Profile</module>
<frontName>profile</frontName>
</args>
</profile>
</routers>
</admin>
<global>
<fieldsets>
<checkout_onepage_quote>
<customer_school>
<to_customer>school</to_customer>
</customer_school>
</checkout_onepage_quote>
<customer_account>
<school>
<to_quote>customer_school</to_quote>
</school>
</customer_account>
</fieldsets>
</global>
<global>
<fieldsets>
<customer_account>
<school><create>1</create><update>1</update><name>1</name></school>
</customer_account>
</fieldsets>
</global>
<global>
<models>
<profile>
<class>Excellence_Profile_Model</class>
<resourceModel>profile_MysqL4</resourceModel>
</profile>
<profile_MysqL4>
<class>Excellence_Profile_Model_MysqL4</class>
<entities>
<profile>
<table>profile</table>
</profile>
</entities>
</profile_MysqL4>
</models>
<resources>
<profile_setup>
<setup>
<module>Excellence_Profile</module>
<class>Mage_Customer_Model_Entity_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</profile_setup>
<profile_write>
<connection>
<use>core_write</use>
</connection>
</profile_write>
<profile_read>
<connection>
<use>core_read</use>
</connection>
</profile_read>
</resources>
<blocks>
<profile>
<class>Excellence_Profile_Block</class>
</profile>
</blocks>
<helpers>
<profile>
<class>Excellence_Profile_Helper</class>
</profile>
</helpers>
</global>
</config>
型号/实体/学校
<?PHP
class Excellence_Profile_Model_Entity_School extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
{
public function getAllOptions()
{
if ($this->_options === null) {
$this->_options = array();
$this->_options[] = array(
'value' => '',
'label' => 'Choose Option..'
);
$this->_options[] = array(
'value' => 1,
'label' => 'School1'
);
$this->_options[] = array(
'value' => 2,
'label' => 'School2'
);
$this->_options[] = array(
'value' => 3,
'label' => 'School3'
);
}
return $this->_options;
}
}
?>
解决方法:
这个答案对我有帮助! Adding Custom Signup Attributes in Magento 1.7
@pragnesh
you can run following script from magento root directory, this scipt
add attribute to customer and accessible in create customer and edit
customer detail, example i have taken'mobile'
here so you can get
that attribute usinggetMobile()
method in edit customer and create
customer page…. this script also automatically add and display in
admin panel try these..
define('MAGENTO', realpath(dirname(__FILE__)));
require_once MAGENTO . '/app/Mage.PHP';
Mage::app();
$installer = new Mage_Customer_Model_Entity_Setup('core_setup');
$installer->startSetup();
$vCustomerEntityType = $installer->getEntityTypeId('customer');
$vCustAttributeSetId = $installer->getDefaultAttributeSetId($vCustomerEntityType);
$vCustAttributeGroupId = $installer->getDefaultAttributeGroupId($vCustomerEntityType, $vCustAttributeSetId);
$installer->addAttribute('customer', 'mobile', array(
'label' => 'Customer Mobile',
'input' => 'text',
'type' => 'varchar',
'forms' => array('customer_account_edit','customer_account_create','adminhtml_customer','checkout_register'),
'required' => 0,
'user_defined' => 1,
));
$installer->addAttributetoGroup($vCustomerEntityType, $vCustAttributeSetId, $vCustAttributeGroupId, 'mobile', 0);
$oAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'mobile');
$oAttribute->setData('used_in_forms', array('customer_account_edit','customer_account_create','adminhtml_customer','checkout_register'));
$oAttribute->save();
$installer->endSetup();
c# – Sitecore – 将自定义字段添加到用户编辑器
我们希望基于Sitecore的网站允许某些人访问其他用户类型无法看到的页面.我们还想要一个具有特定配置文件的所有用户的列表.这让我想到编辑器中的自定义用户字段,但这是否可能,或者有更好的选择吗?
解决方法
Django模型:向自定义字段添加验证
如何提供封装在字段类中的自定义,模型级别,字段验证?
其余的部分
我正在玩两个JSONField实现,(first,second).我正在为我的应用程序使用Django和Django REST框架的组合.我在表单级别上没有做任何事情,只有公开该模型的Web API.
理想情况下,我想在一个地方编写此验证,并在串行器级别模型级别上运行(就像我传递验证器= [x]时).我不能使用通常的验证器= [x]因为我需要允许blank = True但是也验证空白值类型:|.
我有一个用例,我想验证我的JSONField的内容(键,值的类型).使用validictory,我可以这样做:
>在我的save()中强制调用self.full_clean()
>在我的模型上覆盖clean()并在那里进行验证
但是,我真正想要做的是:将此验证添加到JSONField的子类中.我想留下尽可能多的父Field类来做这件事.到目前为止,我有:
from django.db import models from jsonfield import JSONField class myValidatorField(JSONField): def validate(self,*args,**kwargs): # do some validation here super(myValidatorField,self).validate(*args,**kwargs) class MyModel(models.Model): jsonstuff = myValidatorField(default=[]) def save(self,**kwargs): self.full_clean() super(MyModel,self).save(*args,**kwargs)
但是,我无法让这个工作.此validate()方法不适用于second实现,而对于first,它运行4次.
困惑.
解决方法
仅供参考,在我的用例中,我必须实现一个自定义的django rest框架异常处理程序来捕获我的所有模型级ValidationError错误并将它们转换为web 400错误.
# fields.py import validictory from jsonfield import JSONField class JSONSchemaField(JSONField): """A field that will ensure the data entered into it is valid JSON *and* internally validate to a JSON schema of your choice.""" def __init__(self,**kwargs): self.schema = kwargs.pop(''schema'',{}) super(JSONSchemaField,self).__init__(*args,**kwargs) def clean(self,raw_value,model_instance): try: validictory.validate(raw_value,self.schema) except (validictory.FieldValidationError,validictory.SchemaError,validictory.validator.requiredFieldValidationError) as err: raise ValidationError(err) return super(JSONSchemaField,self).clean(raw_value,model_instance) # mixins.py class ModelValidationMixin(object): """Django currently doesn''t force validation on the model level for compatibility reasons. We enforce here,that on each save,a full valdation run will be done the for model instance""" def save(self,**kwargs): self.full_clean() super(ModelValidationMixin,**kwargs) # models.py class MyModel(ModelValidationMixin): json = JSONSchemaField(default=''[]'',schema=SCHEMA)
ios – 如何将自定义HTTP标头字段添加到HLS的AVPlayer请求
解决方法
但从技术上讲,这是一个选择.
NSMutableDictionary* headers = [NSMutableDictionary dictionary]; [headers setobject:@"SOF" forKey:@"X-REQ-HEADER-TEST"]; AVURLAsset* asset = [AVURLAsset URLAssetWithURL:myUrl options:@{@"AVURLAssetHTTPHeaderFieldsKey": headers}]; AVPlayerItem* item = [AVPlayerItem playerItemWithAsset:asset]; [avPlayerObj replaceCurrentItemWithPlayerItem:item];
使用AVURLAssetHTTPHeaderFieldsKey是有问题的.
javascript – 将自定义搜索字段添加到数据表对象
我需要将我在页面上创建的字段添加到Datatables对象.因此,即使它们不是典型的参数(顺序,搜索,分页等),它们也可以与其他Datatables对象状态一起保存和加载.
JavaScript的:
$(document).ready(function () {
var table = $('#stackoverflow-datatable').DataTable({
"processing": true,"stateSave": true,"stateSaveCallback": function (settings,data) {
$.ajax({
"url": "/api/save_state","data": data,"dataType": "json","success": function (response) {}
});
},"stateLoadCallback": function (settings) {
var o;
$.ajax({
"url": "/api/load_state","async": false,"success": function (json) {
o = json;
}
});
return o;
}
});
});
然后我认为将JS添加到对象的JS …
总结
以上是小编为你收集整理的javascript – 将自定义搜索字段添加到数据表对象全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
datatablesdatatables
关于php – Magento将自定义字段添加到客户帐户教程问题和phpmyadmin添加字段的问题我们已经讲解完毕,感谢您的阅读,如果还想了解更多关于c# – Sitecore – 将自定义字段添加到用户编辑器、Django模型:向自定义字段添加验证、ios – 如何将自定义HTTP标头字段添加到HLS的AVPlayer请求、javascript – 将自定义搜索字段添加到数据表对象等相关内容,可以在本站寻找。
本文标签: